Take the native objects from their own flake rather than rebuilding them
jolt-native builds with nix now, so `native` is its packages.default — libvidya, libjolttui and libjoltmoq, as one symlinkJoin. What goes with it is a restatement of upstream's build that lived here only because there was nothing to point at: the seven git deps hashed by hand in cargoLock.outputHashes and re-hashed whenever its Cargo.lock moved, the linuxHeaders path v4l2r's bindgen wants, and the postPatch dropping a .cargo/config.toml that aimed the build at DotSlash. The devShell comment arguing that a cargo build was the price of a derivation a remote builder could take goes too — its CI and this shell now build the same one. Not a pure subtraction: upstream compiles cpal with the `pipewire` feature, which the restatement did not, so device names in a call stop coming out as raw ALSA PCMs. The APK still fetches the v0.1.3 release tarballs. That pin is deliberate — `just bump` moves it — and upstream's android output carries no glue archive. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0ee8bba parent: aaa560d modified
flake.nix +22 -82 | @@ -149,79 +149,21 @@ | ||
| 149 | 149 | |
| 150 | 150 | nixGL = nixGLFor pkgs; |
| 151 | 151 | |
| 152 | - # libvidya (the retained-tree ABI glimmer-vidya binds, on egui) and | |
| 153 | - # libjoltmoq (the AV media plane). One workspace, two cdylibs. | |
| 154 | - native = pkgs.rustPlatform.buildRustPackage { | |
| 155 | - pname = "jolt-native"; | |
| 156 | - version = "0.1.0"; | |
| 157 | - src = jolt-native; | |
| 158 | - | |
| 159 | - # The media plane's deps are seven git repos rather than crates.io | |
| 160 | - # releases. `allowBuiltinFetchGit` would fetch them with | |
| 161 | - # builtins.fetchGit, which happens at *eval* time — so every | |
| 162 | - # evaluation clones them in full (all refs), even when the built | |
| 163 | - # library is already in a cache, and the clones themselves are not | |
| 164 | - # derivations and can never be substituted. Hashed, they are plain | |
| 165 | - # fixed-output derivations: one entry per repo (nixpkgs keys these | |
| 166 | - # by commit, so the sibling crates out of the same workspace are | |
| 167 | - # covered), substitutable, fetched once. The cost is that these | |
| 168 | - # move whenever jolt-native's Cargo.lock does. | |
| 169 | - cargoLock = { | |
| 170 | - lockFile = "${jolt-native}/Cargo.lock"; | |
| 171 | - outputHashes = { | |
| 172 | - # github.com/Frando/moq @ 53fe78d8 — moq-lite, moq-native, hang, conducer | |
| 173 | - "moq-lite-0.15.5" = "sha256-wh8telcXK4Zqaefs42n6LJitye8cc0rAmXd8RtJZJ+Q="; | |
| 174 | - # github.com/n0-computer/iroh-live @ edd9bcc5 — iroh-moq, moq-media, rusty-{capture,codecs} | |
| 175 | - "iroh-live-0.1.0" = "sha256-+bOIMXU4F/9toLZ25MFRA0Kd3Cr4iyP4icOfBkObtfU="; | |
| 176 | - # github.com/n0-computer/iroh @ 8af8370b — iroh, iroh-base, iroh-relay | |
| 177 | - "iroh-0.97.0" = "sha256-tCEzLwu+bcAiH0dMmQoKRB24N5eiNG6BNixod8Y6igo="; | |
| 178 | - # github.com/Frando/web-transport @ f7a523f1 — the four web-transport-* crates | |
| 179 | - "web-transport-proto-0.6.0" = "sha256-5WP98+nTI6FR23AM7DNf0nnsolqr7M0RHxY09NNdDzs="; | |
| 180 | - # github.com/n0-computer/noq @ ab042ea7 — noq, noq-proto, noq-udp | |
| 181 | - "noq-0.17.0" = "sha256-aur6ekfwr3PsnR8RrBKLgCvujQRi4tccyK9nJo6O+Tg="; | |
| 182 | - "iroh-gossip-0.97.0" = "sha256-DEIq1BCsCZL+1q9yiEZAXzv7wxvIXgsW044Y8uHW7PU="; | |
| 183 | - "iroh-smol-kv-0.3.1" = "sha256-oXGdnJVyQfiomzyZhj5r7ez4Uxh73imGt6V9+vHTQZQ="; | |
| 184 | - }; | |
| 185 | - }; | |
| 186 | - | |
| 187 | - nativeBuildInputs = with pkgs; [ | |
| 188 | - pkg-config | |
| 189 | - cmake | |
| 190 | - rustPlatform.bindgenHook | |
| 191 | - ]; | |
| 192 | - | |
| 193 | - buildInputs = with pkgs; [ | |
| 194 | - alsa-lib | |
| 195 | - pipewire | |
| 196 | - openssl | |
| 197 | - libxkbcommon | |
| 198 | - wayland | |
| 199 | - libGL | |
| 200 | - ]; | |
| 201 | - | |
| 202 | - # Upstream's .cargo/config.toml drives the whole build through | |
| 203 | - # DotSlash: a pinned rustc, sccache, and zig as the C/C++ compiler | |
| 204 | - # and linker, each fetched from the network on first use. None of | |
| 205 | - # that survives a build sandbox, and none of it is needed when the | |
| 206 | - # toolchain comes from the store — so drop it and let stdenv's cc | |
| 207 | - # link (openh264 is C++, which stdenv covers too). | |
| 208 | - postPatch = '' | |
| 209 | - rm -f .cargo/config.toml | |
| 210 | - ''; | |
| 211 | - | |
| 212 | - # bindgen reads linux/videodev2.h directly; upstream points it at | |
| 213 | - # zig's bundled headers, which under Nix is just the kernel headers. | |
| 214 | - V4L2R_VIDEODEV2_H_PATH = "${pkgs.linuxHeaders}/include"; | |
| 215 | - | |
| 216 | - doCheck = false; | |
| 217 | - | |
| 218 | - installPhase = '' | |
| 219 | - runHook preInstall | |
| 220 | - mkdir -p "$out/lib" | |
| 221 | - install -m644 target/*/release/*.so "$out/lib/" | |
| 222 | - runHook postInstall | |
| 223 | - ''; | |
| 224 | - }; | |
| 152 | + # libvidya (the retained-tree ABI glimmer-vidya binds, on egui), | |
| 153 | + # libjolttui (the same tree over a grid of cells) and libjoltmoq (the | |
| 154 | + # AV media plane) — one workspace, three cdylibs, taken from | |
| 155 | + # jolt-native's own flake rather than rebuilt here. | |
| 156 | + # | |
| 157 | + # This used to be a rustPlatform.buildRustPackage over the same | |
| 158 | + # source, which meant restating upstream's build: the seven git deps | |
| 159 | + # hashed by hand in `cargoLock.outputHashes` and re-hashed whenever | |
| 160 | + # its Cargo.lock moved, the linuxHeaders path v4l2r's bindgen wants, | |
| 161 | + # and a postPatch dropping the .cargo/config.toml that pointed the | |
| 162 | + # build at DotSlash. Upstream's flake says all of that itself now, | |
| 163 | + # and says it once. It also builds cpal with the `pipewire` feature, | |
| 164 | + # which the restatement did not — so device names in a call are | |
| 165 | + # PipeWire's rather than raw ALSA PCMs. | |
| 166 | + native = jolt-native.packages.${pkgs.stdenv.hostPlatform.system}.default; | |
| 225 | 167 | |
| 226 | 168 | # Jolt itself: Clojure on Chez, built the way its own flake builds it. |
| 227 | 169 | # A function, because there are two of them — upstream for the |
| @@ -412,15 +354,13 @@ | ||
| 412 | 354 | # drift the `jolt-native` input's comment is about, and a pin frq can |
| 413 | 355 | # answer for is worth more here than the convenience of a checkout. |
| 414 | 356 | # |
| 415 | - # `native` is the cargo build of that input rather than jolt-native's own | |
| 416 | - # buck2 graph, which is a compromise and not a free one: buck2 is what | |
| 417 | - # its CI runs and what makes its releases, and its cpal has the pipewire | |
| 418 | - # feature this one does not, so device *names* in a call come out as ALSA | |
| 419 | - # PCMs. What it buys is a derivation — one thing nixbuild.net can be | |
| 420 | - # handed. The buck2 build fetches its rustc, zig and every third-party | |
| 421 | - # crate as it goes and writes buck-out into the tree it builds; a sandbox | |
| 422 | - # with no network and a read-only store is the one place it cannot run, | |
| 423 | - # so on a remote builder it is not a slower option but no option at all. | |
| 357 | + # `native` is jolt-native's own flake output. It was a buck2 graph when | |
| 358 | + # this comment was first written and a cargo build restated here when it | |
| 359 | + # was second: buck2 fetches its rustc, zig and every third-party crate as | |
| 360 | + # it goes and writes buck-out into the tree it builds, so a sandbox with | |
| 361 | + # no network and a read-only store was the one place it could not run. | |
| 362 | + # Upstream builds with nix now, so the thing its CI runs and the thing | |
| 363 | + # this shell hands a builder are the same derivation. | |
| 424 | 364 | # |
| 425 | 365 | # Nothing here says "nixbuild", though: it is a plain derivation, and |
| 426 | 366 | # where it gets built is the machine's business. scripts/run.bb asks for |
| @@ -149,79 +149,21 @@ | |||
| 149 | 149 | ||
| 150 | nixGL = nixGLFor pkgs; | 150 | nixGL = nixGLFor pkgs; |
| 151 | 151 | ||
| 152 | - # libvidya (the retained-tree ABI glimmer-vidya binds, on egui) and | 152 | + # libvidya (the retained-tree ABI glimmer-vidya binds, on egui), |
| 153 | - # libjoltmoq (the AV media plane). One workspace, two cdylibs. | 153 | + # libjolttui (the same tree over a grid of cells) and libjoltmoq (the |
| 154 | - native = pkgs.rustPlatform.buildRustPackage { | 154 | + # AV media plane) — one workspace, three cdylibs, taken from |
| 155 | - pname = "jolt-native"; | 155 | + # jolt-native's own flake rather than rebuilt here. |
| 156 | - version = "0.1.0"; | 156 | + # |
| 157 | - src = jolt-native; | 157 | + # This used to be a rustPlatform.buildRustPackage over the same |
| 158 | - | 158 | + # source, which meant restating upstream's build: the seven git deps |
| 159 | - # The media plane's deps are seven git repos rather than crates.io | 159 | + # hashed by hand in `cargoLock.outputHashes` and re-hashed whenever |
| 160 | - # releases. `allowBuiltinFetchGit` would fetch them with | 160 | + # its Cargo.lock moved, the linuxHeaders path v4l2r's bindgen wants, |
| 161 | - # builtins.fetchGit, which happens at *eval* time — so every | 161 | + # and a postPatch dropping the .cargo/config.toml that pointed the |
| 162 | - # evaluation clones them in full (all refs), even when the built | 162 | + # build at DotSlash. Upstream's flake says all of that itself now, |
| 163 | - # library is already in a cache, and the clones themselves are not | 163 | + # and says it once. It also builds cpal with the `pipewire` feature, |
| 164 | - # derivations and can never be substituted. Hashed, they are plain | 164 | + # which the restatement did not — so device names in a call are |
| 165 | - # fixed-output derivations: one entry per repo (nixpkgs keys these | 165 | + # PipeWire's rather than raw ALSA PCMs. |
| 166 | - # by commit, so the sibling crates out of the same workspace are | 166 | + native = jolt-native.packages.${pkgs.stdenv.hostPlatform.system}.default; |
| 167 | - # covered), substitutable, fetched once. The cost is that these | ||
| 168 | - # move whenever jolt-native's Cargo.lock does. | ||
| 169 | - cargoLock = { | ||
| 170 | - lockFile = "${jolt-native}/Cargo.lock"; | ||
| 171 | - outputHashes = { | ||
| 172 | - # github.com/Frando/moq @ 53fe78d8 — moq-lite, moq-native, hang, conducer | ||
| 173 | - "moq-lite-0.15.5" = "sha256-wh8telcXK4Zqaefs42n6LJitye8cc0rAmXd8RtJZJ+Q="; | ||
| 174 | - # github.com/n0-computer/iroh-live @ edd9bcc5 — iroh-moq, moq-media, rusty-{capture,codecs} | ||
| 175 | - "iroh-live-0.1.0" = "sha256-+bOIMXU4F/9toLZ25MFRA0Kd3Cr4iyP4icOfBkObtfU="; | ||
| 176 | - # github.com/n0-computer/iroh @ 8af8370b — iroh, iroh-base, iroh-relay | ||
| 177 | - "iroh-0.97.0" = "sha256-tCEzLwu+bcAiH0dMmQoKRB24N5eiNG6BNixod8Y6igo="; | ||
| 178 | - # github.com/Frando/web-transport @ f7a523f1 — the four web-transport-* crates | ||
| 179 | - "web-transport-proto-0.6.0" = "sha256-5WP98+nTI6FR23AM7DNf0nnsolqr7M0RHxY09NNdDzs="; | ||
| 180 | - # github.com/n0-computer/noq @ ab042ea7 — noq, noq-proto, noq-udp | ||
| 181 | - "noq-0.17.0" = "sha256-aur6ekfwr3PsnR8RrBKLgCvujQRi4tccyK9nJo6O+Tg="; | ||
| 182 | - "iroh-gossip-0.97.0" = "sha256-DEIq1BCsCZL+1q9yiEZAXzv7wxvIXgsW044Y8uHW7PU="; | ||
| 183 | - "iroh-smol-kv-0.3.1" = "sha256-oXGdnJVyQfiomzyZhj5r7ez4Uxh73imGt6V9+vHTQZQ="; | ||
| 184 | - }; | ||
| 185 | - }; | ||
| 186 | - | ||
| 187 | - nativeBuildInputs = with pkgs; [ | ||
| 188 | - pkg-config | ||
| 189 | - cmake | ||
| 190 | - rustPlatform.bindgenHook | ||
| 191 | - ]; | ||
| 192 | - | ||
| 193 | - buildInputs = with pkgs; [ | ||
| 194 | - alsa-lib | ||
| 195 | - pipewire | ||
| 196 | - openssl | ||
| 197 | - libxkbcommon | ||
| 198 | - wayland | ||
| 199 | - libGL | ||
| 200 | - ]; | ||
| 201 | - | ||
| 202 | - # Upstream's .cargo/config.toml drives the whole build through | ||
| 203 | - # DotSlash: a pinned rustc, sccache, and zig as the C/C++ compiler | ||
| 204 | - # and linker, each fetched from the network on first use. None of | ||
| 205 | - # that survives a build sandbox, and none of it is needed when the | ||
| 206 | - # toolchain comes from the store — so drop it and let stdenv's cc | ||
| 207 | - # link (openh264 is C++, which stdenv covers too). | ||
| 208 | - postPatch = '' | ||
| 209 | - rm -f .cargo/config.toml | ||
| 210 | - ''; | ||
| 211 | - | ||
| 212 | - # bindgen reads linux/videodev2.h directly; upstream points it at | ||
| 213 | - # zig's bundled headers, which under Nix is just the kernel headers. | ||
| 214 | - V4L2R_VIDEODEV2_H_PATH = "${pkgs.linuxHeaders}/include"; | ||
| 215 | - | ||
| 216 | - doCheck = false; | ||
| 217 | - | ||
| 218 | - installPhase = '' | ||
| 219 | - runHook preInstall | ||
| 220 | - mkdir -p "$out/lib" | ||
| 221 | - install -m644 target/*/release/*.so "$out/lib/" | ||
| 222 | - runHook postInstall | ||
| 223 | - ''; | ||
| 224 | - }; | ||
| 225 | 167 | ||
| 226 | # Jolt itself: Clojure on Chez, built the way its own flake builds it. | 168 | # Jolt itself: Clojure on Chez, built the way its own flake builds it. |
| 227 | # A function, because there are two of them — upstream for the | 169 | # A function, because there are two of them — upstream for the |
| @@ -412,15 +354,13 @@ | |||
| 412 | # drift the `jolt-native` input's comment is about, and a pin frq can | 354 | # drift the `jolt-native` input's comment is about, and a pin frq can |
| 413 | # answer for is worth more here than the convenience of a checkout. | 355 | # answer for is worth more here than the convenience of a checkout. |
| 414 | # | 356 | # |
| 415 | - # `native` is the cargo build of that input rather than jolt-native's own | 357 | + # `native` is jolt-native's own flake output. It was a buck2 graph when |
| 416 | - # buck2 graph, which is a compromise and not a free one: buck2 is what | 358 | + # this comment was first written and a cargo build restated here when it |
| 417 | - # its CI runs and what makes its releases, and its cpal has the pipewire | 359 | + # was second: buck2 fetches its rustc, zig and every third-party crate as |
| 418 | - # feature this one does not, so device *names* in a call come out as ALSA | 360 | + # it goes and writes buck-out into the tree it builds, so a sandbox with |
| 419 | - # PCMs. What it buys is a derivation — one thing nixbuild.net can be | 361 | + # no network and a read-only store was the one place it could not run. |
| 420 | - # handed. The buck2 build fetches its rustc, zig and every third-party | 362 | + # Upstream builds with nix now, so the thing its CI runs and the thing |
| 421 | - # crate as it goes and writes buck-out into the tree it builds; a sandbox | 363 | + # this shell hands a builder are the same derivation. |
| 422 | - # with no network and a read-only store is the one place it cannot run, | ||
| 423 | - # so on a remote builder it is not a slower option but no option at all. | ||
| 424 | # | 364 | # |
| 425 | # Nothing here says "nixbuild", though: it is a plain derivation, and | 365 | # Nothing here says "nixbuild", though: it is a plain derivation, and |
| 426 | # where it gets built is the machine's business. scripts/run.bb asks for | 366 | # where it gets built is the machine's business. scripts/run.bb asks for |