nandi/jolt-nativepublic Fork 0
4706c92
Commits
Clone
git clone https://git.rickub.com/nandi/jolt-native.git
git clone ssh://git@rickub.com/nandi/jolt-native.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Build libjoltcosmic out of the flake, so frq can link it

crates/jolt-cosmic has been a workspace member for a while and the flake
never named it, so the one way to a libjoltcosmic.so was `cargo build
--release -p jolt-cosmic` in a checkout — which is what frq's `just cosmic`
told you to do, and why frq could run the window from a tree beside it but
never from a pin.

Its own deps artifact rather than a share of the UI one. libcosmic brings
iced, wgpu, cosmic-text and zbus with it, which is the reason the crate is
its own crate at all; folding those into the artifact libjolttui waits on
would make every terminal build pay for a GPU stack it never loads.

`soPackage` grows a `headers` flag for this. It copied crates/<dir>/include
unconditionally and jolt-cosmic has no include to copy: the jolt side
reaches it through jolt.ffi by symbol name, so there is no C API for an
embedder to include a header for. The other three keep the old behaviour,
where a header that stops being there fails the build rather than shipping
an object with no ABI beside it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-11T17:23:51-07:00 Browse files
4706c92 parent: 1ee075a
modified flake.nix +26 -3
@@ -163,6 +163,14 @@
163163 pname = "jolt-native-moq-deps";
164164 packages = [ "jolt-moq" ];
165165 };
166+ # Its own artifact rather than a share of the UI one, for the reason
167+ # crates/jolt-cosmic/Cargo.toml gives: libcosmic drags iced, wgpu,
168+ # cosmic-text and zbus in behind it, and none of that belongs in the
169+ # dependency build a terminal backend waits on.
170+ cosmicArtifacts = depsFor {
171+ pname = "jolt-native-cosmic-deps";
172+ packages = [ "jolt-cosmic" ];
173+ };
166174
167175 # The whole workspace, for the clippy and test runs — those do build
168176 # everything, and want the sharing this split gives up.
@@ -179,7 +187,12 @@
179187 # crates/jolt-vidya. Nothing is silenced — a header that stops being
180188 # there should fail the build rather than ship an object with no ABI
181189 # beside it.
182- soPackage = { pname, package, dir, soname, artifacts }:
190+ # `headers` is false for a backend that exports no C API of its own.
191+ # jolt-cosmic is one: the jolt side reaches it through jolt.ffi by
192+ # symbol name, so there is no header for an embedder to include and no
193+ # crates/jolt-cosmic/include to copy. The others keep the check that
194+ # a vanished header fails the build.
195+ soPackage = { pname, package, dir, soname, artifacts, headers ? true }:
183196 craneLib.buildPackage (commonArgs // {
184197 inherit pname;
185198 cargoArtifacts = artifacts;
@@ -187,8 +200,10 @@
187200 cargoExtraArgs = "--locked -p ${package}";
188201 doCheck = false;
189202 installPhaseCommand = ''
190- mkdir -p $out/lib $out/include
203+ mkdir -p $out/lib
191204 cp target/release/${soname} $out/lib/
205+ '' + lib.optionalString headers ''
206+ mkdir -p $out/include
192207 cp -r crates/${dir}/include/. $out/include/
193208 '';
194209 });
@@ -214,6 +229,14 @@
214229 dir = "jolt-moq";
215230 soname = "libjoltmoq.so";
216231 };
232+ libjoltcosmic = soPackage {
233+ artifacts = cosmicArtifacts;
234+ pname = "libjoltcosmic";
235+ package = "jolt-cosmic";
236+ dir = "jolt-cosmic";
237+ soname = "libjoltcosmic.so";
238+ headers = false;
239+ };
217240
218241 # The phone. Same sources, same Cargo.lock, only the target
219242 # configuration moves — which is what //:libs-android and its pair of
@@ -301,7 +324,7 @@
301324 packages = {
302325 default = libs;
303326 android = libsAndroid;
304- inherit libs libvidya libjolttui libjoltmoq;
327+ inherit libs libvidya libjolttui libjoltmoq libjoltcosmic;
305328 };
306329
307330 # Just the X11 client library on LD_LIBRARY_PATH, for `jolt gfx-demo`.
@@ -163,6 +163,14 @@
163 pname = "jolt-native-moq-deps";163 pname = "jolt-native-moq-deps";
164 packages = [ "jolt-moq" ];164 packages = [ "jolt-moq" ];
165 };165 };
166+ # Its own artifact rather than a share of the UI one, for the reason
167+ # crates/jolt-cosmic/Cargo.toml gives: libcosmic drags iced, wgpu,
168+ # cosmic-text and zbus in behind it, and none of that belongs in the
169+ # dependency build a terminal backend waits on.
170+ cosmicArtifacts = depsFor {
171+ pname = "jolt-native-cosmic-deps";
172+ packages = [ "jolt-cosmic" ];
173+ };
166 174
167 # The whole workspace, for the clippy and test runs — those do build175 # The whole workspace, for the clippy and test runs — those do build
168 # everything, and want the sharing this split gives up.176 # everything, and want the sharing this split gives up.
@@ -179,7 +187,12 @@
179 # crates/jolt-vidya. Nothing is silenced — a header that stops being187 # crates/jolt-vidya. Nothing is silenced — a header that stops being
180 # there should fail the build rather than ship an object with no ABI188 # there should fail the build rather than ship an object with no ABI
181 # beside it.189 # beside it.
182- soPackage = { pname, package, dir, soname, artifacts }:190+ # `headers` is false for a backend that exports no C API of its own.
191+ # jolt-cosmic is one: the jolt side reaches it through jolt.ffi by
192+ # symbol name, so there is no header for an embedder to include and no
193+ # crates/jolt-cosmic/include to copy. The others keep the check that
194+ # a vanished header fails the build.
195+ soPackage = { pname, package, dir, soname, artifacts, headers ? true }:
183 craneLib.buildPackage (commonArgs // {196 craneLib.buildPackage (commonArgs // {
184 inherit pname;197 inherit pname;
185 cargoArtifacts = artifacts;198 cargoArtifacts = artifacts;
@@ -187,8 +200,10 @@
187 cargoExtraArgs = "--locked -p ${package}";200 cargoExtraArgs = "--locked -p ${package}";
188 doCheck = false;201 doCheck = false;
189 installPhaseCommand = ''202 installPhaseCommand = ''
190- mkdir -p $out/lib $out/include203+ mkdir -p $out/lib
191 cp target/release/${soname} $out/lib/204 cp target/release/${soname} $out/lib/
205+ '' + lib.optionalString headers ''
206+ mkdir -p $out/include
192 cp -r crates/${dir}/include/. $out/include/207 cp -r crates/${dir}/include/. $out/include/
193 '';208 '';
194 });209 });
@@ -214,6 +229,14 @@
214 dir = "jolt-moq";229 dir = "jolt-moq";
215 soname = "libjoltmoq.so";230 soname = "libjoltmoq.so";
216 };231 };
232+ libjoltcosmic = soPackage {
233+ artifacts = cosmicArtifacts;
234+ pname = "libjoltcosmic";
235+ package = "jolt-cosmic";
236+ dir = "jolt-cosmic";
237+ soname = "libjoltcosmic.so";
238+ headers = false;
239+ };
217 240
218 # The phone. Same sources, same Cargo.lock, only the target241 # The phone. Same sources, same Cargo.lock, only the target
219 # configuration moves — which is what //:libs-android and its pair of242 # configuration moves — which is what //:libs-android and its pair of
@@ -301,7 +324,7 @@
301 packages = {324 packages = {
302 default = libs;325 default = libs;
303 android = libsAndroid;326 android = libsAndroid;
304- inherit libs libvidya libjolttui libjoltmoq;327+ inherit libs libvidya libjolttui libjoltmoq libjoltcosmic;
305 };328 };
306 329
307 # Just the X11 client library on LD_LIBRARY_PATH, for `jolt gfx-demo`.330 # Just the X11 client library on LD_LIBRARY_PATH, for `jolt gfx-demo`.