nandi/frqpublic Fork 0
aaa560d11a676127bc189775cf50bf17b0bc8f3e
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

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

flake.nix · 471 lines · 21.9 KBNix Blame HistoryRaw
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago1{
2 # frq is Jolt source, so "building" it is three things, not one:
3 #
4 # jolt the runtime that reads it (github:jolt-lang/jolt)
5 # jolt-native libvidya and libjoltmoq, in Rust (gitlab:nandithebull/jolt-native)
6 # frq this tree, with its deps resolved to store paths
7 #
8 # Jolt resolves deps.edn by running git at startup, which a build sandbox has
9 # no network for — so every dep is fetched by Nix instead and handed back as
10 # a :local/root through -Sdeps.
11 #
12 # nix build .#frq && ./result/bin/frq
13 #
14 # On a machine that is not NixOS the GL driver is the host's and the loader
15 # will not find it, so the window never opens ("GL display: argument does not
Find the host's GL driver when the store's is not the system's 633faad nandi 19d ago16 # name a valid config"). The launcher handles that itself: off NixOS it hands
17 # the process to nixGL, which puts the host's driver ahead of the store's.
18 # Nothing extra to type, and a distrobox/container Arch is the same case as
19 # a bare one.
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago20 description = "frq a freeq client in jolt";
21
22 inputs = {
23 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
Take jolt and jolt-native as flakes, off my own fork aaa560d nandi 13d ago24 # `git+https` with `?submodules=1` rather than the github scheme: Jolt's
25 # own flake declares `self.submodules`, which this Nix rejects when the
26 # flake is fetched as `github:`. Its outputs are not what we take — the
27 # runtime is built here, by joltFrom — but it is a flake all the same, so
28 # its own inputs are locked with ours rather than left to float, and
29 # `vendor/` comes along as the submodule the build needs.
30 #
31 # The fork rather than jolt-lang/jolt: it is what jolt-android-src already
32 # pins for the boot image, and a desktop runtime built from a different
33 # tree than the APK's is the same drift the jolt-native comment warns
34 # about. Unpinned here — the desktop follows the fork's main, while the
35 # APK stays on the rev below.
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago36 jolt-src = {
Take jolt and jolt-native as flakes, off my own fork aaa560d nandi 13d ago37 url = "git+https://gitlab.com/nandithebull/jolt?submodules=1";
38 inputs.nixpkgs.follows = "nixpkgs";
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago39 };
40
Build the desktop libraries rather than fetching a release of them 0b81161 nandi 15d ago41 # Ahead of v0.1.3, which is what nix/android.nix pins the APK to — and
42 # deliberately: that pin is the last release, and this is what `just run`
43 # builds, so a change to jolt-native can be run before there is a release
44 # to fetch. The two meet again at `just bump`.
Take the jolt-native ahead of the release, since a run can build it 36f6c77 nandi 17d ago45 #
46 # Pinned all the same, and pinned to a rev: this input carries both halves of
Pin the native half to the release the rest of the tree names cb7f9f1 nandi 17d ago47 # glimmer-vidya — libvidya, and the Jolt side that binds it — so an
48 # unpinned `main` is a build whose native half is free to sit at a
49 # different commit from the tree that talks to it. It did, and what the
50 # drift cost was silence: the Jolt half sent a reaction pill's hover card
51 # to a libvidya with no handler for one, and the pill said nothing.
Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago52 # It also carries the terminal backend — crates/jolt-tui, the same tree ABI
53 # over a grid of cells, and jolt/glimmer-tui beside glimmer-vidya. That was
54 # a second input at a second rev while it lived on a branch, which is the
55 # drift this comment warns about wearing a different hat: one input, and
56 # the window and the terminal are the same library either way.
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago57 jolt-native = {
Take jolt and jolt-native as flakes, off my own fork aaa560d nandi 13d ago58 url = "git+https://gitlab.com/nandithebull/jolt-native?rev=4956d1e2f73eae7b1f8ef16fab875c56c69dea84";
59 inputs.nixpkgs.follows = "nixpkgs";
Paint the same screens into a terminal ab83b42 nandi 17d ago60 };
61
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago62 # Chez itself, because the APK needs a cross target nixpkgs does not
63 # build: frq's Scheme is compiled to an arm64 boot image, and that wants
64 # Chez's own `tarm64le` workarea — boot files, xpatch and libkernel.a.
65 # The version is the one the hand-built tree under ~/.cache used, and the
66 # submodules are not optional (zuo builds it, lz4 and zlib link into it).
Take jolt and jolt-native as flakes, off my own fork aaa560d nandi 13d ago67 # The same fork jolt-src takes, built here rather than fetched as a
68 # release binary: upstream reads the socket address out of `struct
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago69 # addrinfo` at glibc's offset, which on Bionic is `ai_canonname`, so an APK
Take jolt and jolt-native as flakes, off my own fork aaa560d nandi 13d ago70 # built with upstream cannot open a TLS connection at all. Pinned to a rev
71 # where jolt-src is not: the APK is a release artefact, so its runtime
72 # moves when `just bump` says so rather than when the fork does.
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago73 jolt-android-src = {
74 url = "git+https://gitlab.com/nandithebull/jolt?rev=2b80d68d1f7a31ba92b208b3957e5fb555617ada&submodules=1";
Take jolt and jolt-native as flakes, off my own fork aaa560d nandi 13d ago75 inputs.nixpkgs.follows = "nixpkgs";
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago76 };
77
78 chez-src = {
79 url = "git+https://github.com/cisco/ChezScheme?ref=refs/tags/v10.4.1&submodules=1";
80 flake = false;
81 };
82
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago83 # The sha deps.edn pins, on the fork with the reconciler fixes.
84 glimmer = {
85 url = "git+https://gitlab.com/nandithebull/glimmer?rev=399df371c790d690fb6e4560c3d4d7f838502857";
86 flake = false;
87 };
Find the host's GL driver when the store's is not the system's 633faad nandi 19d ago88
89 # Only ever used off NixOS, to put the host GL driver on the loader path.
90 nixgl = {
91 url = "github:nix-community/nixGL";
92 inputs.nixpkgs.follows = "nixpkgs";
93 };
Bundle the closure into one file the AppImage runtime mounts f82b93f nandi 18d ago94
95 # Wraps a closure into a single self-extracting file. Only the `appimage`
96 # output evaluates it.
97 nix-appimage = {
98 url = "github:ralismark/nix-appimage";
99 inputs.nixpkgs.follows = "nixpkgs";
100 };
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago101 };
102
Bundle the closure into one file the AppImage runtime mounts f82b93f nandi 18d ago103 outputs = { self, nixpkgs, jolt-src, jolt-native, glimmer, chez-src, jolt-android-src, nixgl, nix-appimage }:
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago104 let
105 systems = [ "x86_64-linux" "aarch64-linux" ];
106 forEachSystem = f:
107 nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
Run this tree on a native half the builders made a32699e nandi 17d ago108
109 # Mesa, despite the name: it covers Intel and AMD alike. The NVIDIA
110 # wrappers are the ones that need --impure (they read the host kernel
111 # module's version), which is why this only ever reaches for Intel.
Stop carrying the 32-bit GL stack and half of git 040f2c1 nandi 16d ago112 #
113 # Built from nixGL's default.nix rather than taken from its flake
114 # outputs, for the one argument the flake hardcodes on: `enable32bits`,
115 # which on x86_64 puts a second, i686 copy of mesa, its LLVM, and
116 # intel-media-driver into the wrapper. frq is 64-bit on both halves —
117 # the Rust cdylibs and the Chez runtime — so nothing here ever opens the
118 # 32-bit driver, and carrying it is most of the dev shell's closure.
119 nixGLFor = pkgs: (import nixgl {
120 inherit pkgs;
121 enable32bits = false;
122 }).nixGLIntel;
Run this tree on a native half the builders made a32699e nandi 17d ago123
124 # egui reaches for these with dlopen rather than linking them, so being
125 # in the cdylib's buildInputs is not enough — whatever starts frq has to
Follow the xorg renames, and stop wrapping nix in distrobox a400a00 nandi 16d ago126 # put them on the loader path itself. Without libx11 here, vidya reports
Run this tree on a native half the builders made a32699e nandi 17d ago127 # "X11 unavailable", falls back to Wayland, and winit refuses to build a
128 # second event loop after the failed first one.
129 #
130 # Out here rather than beside the package that first needed them: the
131 # dev shell starts frq too, on this tree's source rather than the store's
132 # copy of it, and a second copy of this list is a second chance for the
133 # two ways of running to disagree about what the window needs.
134 runtimeLibsFor = pkgs: with pkgs; [
135 libGL
136 libxkbcommon
137 wayland
Follow the xorg renames, and stop wrapping nix in distrobox a400a00 nandi 16d ago138 libx11
139 libxcursor
140 libxi
141 libxrandr
Run this tree on a native half the builders made a32699e nandi 17d ago142 vulkan-loader
143 ];
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago144 in
145 {
146 packages = forEachSystem (pkgs:
147 let
148 inherit (pkgs) lib;
149
Run this tree on a native half the builders made a32699e nandi 17d ago150 nixGL = nixGLFor pkgs;
Find the host's GL driver when the store's is not the system's 633faad nandi 19d ago151
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago152 # 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
Hash the media plane's git deps rather than cloning them per eval 7095bb6 nandi 16d ago159 # 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.
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago169 cargoLock = {
170 lockFile = "${jolt-native}/Cargo.lock";
Hash the media plane's git deps rather than cloning them per eval 7095bb6 nandi 16d ago171 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 };
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago185 };
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
226 # Jolt itself: Clojure on Chez, built the way its own flake builds it.
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago227 # A function, because there are two of them — upstream for the
228 # desktop, and the Bionic-addrinfo fork for the boot image the APK
229 # carries. Nothing else about the build differs.
230 joltFrom = src: pkgs.stdenv.mkDerivation {
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago231 pname = "jolt";
232 version = "dev";
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago233 inherit src;
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago234
235 strictDeps = true;
236 nativeBuildInputs = with pkgs; [ chez makeWrapper pkg-config xxd ];
237 buildInputs = with pkgs; [ lz4 zlib ncurses openssl libuuid ];
238
239 JOLT_VERSION = "dev";
240 dontConfigure = true;
241
242 buildPhase = ''
243 runHook preBuild
244 scheme --script host/chez/build-jolt.ss release target/release/jolt
245 runHook postBuild
246 '';
247
248 installPhase = ''
249 runHook preInstall
250 mkdir -p "$out/bin"
251 install -m755 target/release/jolt "$out/bin/jolt"
252 runHook postInstall
253 '';
254
255 # jolt.deps shells out to git and unzip, and jolt.mvn-http dlopens
Stop carrying the 32-bit GL stack and half of git 040f2c1 nandi 16d ago256 # OpenSSL through the JOLT_OPENSSL_LIBDIR seam. gitMinimal rather
257 # than git: all jolt.deps asks for is clone/fetch/rev-parse, and
258 # the full package carries Perl and Python for the subcommands
259 # written in them — a quarter of a gigabyte for git-send-email.
Read the clock in the reader's zone when /etc/localtime is a file bffe879 nandi 18d ago260 #
261 # TZDIR so a zone *name* resolves wherever this runs: frq.clock
262 # hands one to tzset, and glibc then looks for the tzfile under
263 # /usr/share/zoneinfo unless told otherwise — which a NixOS host
264 # does not have. The store's own tzdata is there on both kinds of
265 # machine. --set-default, so a TZDIR the user set still wins.
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago266 postFixup = ''
267 wrapProgram "$out/bin/jolt" \
Stop carrying the 32-bit GL stack and half of git 040f2c1 nandi 16d ago268 --prefix PATH : "${pkgs.lib.makeBinPath [ pkgs.gitMinimal pkgs.unzip ]}" \
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago269 --set-default JOLT_OPENSSL_LIBDIR "${pkgs.lib.makeLibraryPath [ pkgs.openssl ]}" \
Read the clock in the reader's zone when /etc/localtime is a file bffe879 nandi 18d ago270 --set-default TZDIR "${pkgs.tzdata}/share/zoneinfo" \
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago271 --set-default SSL_CERT_FILE "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
272 '';
273 };
274
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago275 joltRuntime = joltFrom jolt-src;
276 joltAndroid = joltFrom jolt-android-src;
277
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago278 # glimmer-vidya lives inside the jolt-native checkout, and its own
279 # deps.edn asks for glimmer by git — the top-level override below
280 # answers for both.
281 glimmerVidya = "${jolt-native}/jolt/glimmer-vidya";
Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago282 glimmerTui = "${jolt-native}/jolt/glimmer-tui";
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago283
Run this tree on a native half the builders made a32699e nandi 17d ago284 runtimeLibs = runtimeLibsFor pkgs;
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago285
286 # The project as jolt sees it: source, deps.edn, nothing else.
287 frqSource = pkgs.runCommand "frq-source" { } ''
288 mkdir -p "$out"
289 cp -r ${self}/src ${self}/deps.edn "$out/"
290 '';
291
292 # Jolt resolves deps.edn from the working directory, so the launcher
293 # runs from the store copy. Its .jolt/cpcache write lands on a
294 # read-only directory and jolt treats that as a quiet cache miss, so
295 # the only cost is re-resolving the (already local) graph per start.
296 frqScript = pkgs.writeShellScript "frq" ''
297 export LD_LIBRARY_PATH="${native}/lib:${lib.makeLibraryPath runtimeLibs}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
298 cd ${frqSource}
Find the host's GL driver when the store's is not the system's 633faad nandi 19d ago299
300 # On NixOS the store's Mesa is the system's and the window opens.
301 # Anywhere else the real driver is the host's, so defer to nixGL
302 # it prepends the host driver, which has to win over ours.
303 runner=""
304 [ -e /run/current-system ] || runner="${nixGL}/bin/nixGLIntel"
305
306 exec ''${runner} ${joltRuntime}/bin/jolt \
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago307 -Sdeps '{:deps {jolt-lang/glimmer {:local/root "${glimmer}"} nandi/glimmer-vidya {:local/root "${glimmerVidya}"}}}' \
308 -M:frq "$@"
309 '';
310
Paint the same screens into a terminal ab83b42 nandi 17d ago311 # The same source, the other backend. No GL, no nixGL and no X11 —
312 # a terminal is the one surface that needs nothing from the host but
313 # a terminal, which is the reason this output exists.
314 tuiScript = pkgs.writeShellScript "frq-tui" ''
Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago315 export LD_LIBRARY_PATH="${native}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
Paint the same screens into a terminal ab83b42 nandi 17d ago316 cd ${frqSource}
317
318 exec ${joltRuntime}/bin/jolt \
319 -Sdeps '{:deps {jolt-lang/glimmer {:local/root "${glimmer}"} nandi/glimmer-vidya {:local/root "${glimmerVidya}"} nandi/glimmer-tui {:local/root "${glimmerTui}"}}}' \
320 -m frq.tui "$@"
321 '';
322
323 tui = pkgs.runCommand "frq-tui-0.1.0"
324 {
325 meta = {
326 description = "frq's screens in a terminal";
327 mainProgram = "frq-tui";
328 platforms = systems;
329 };
330 }
331 ''
332 mkdir -p "$out/bin"
333 ln -s ${tuiScript} "$out/bin/frq-tui"
334 '';
335
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago336 frq = pkgs.runCommand "frq-0.1.0"
337 {
338 meta = {
339 description = "A freeq client in jolt";
340 mainProgram = "frq";
341 platforms = systems;
342 };
343 }
344 ''
345 mkdir -p "$out/bin"
346 ln -s ${frqScript} "$out/bin/frq"
347 '';
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago348 # --- Android ------------------------------------------------------
349 # The SDK and the NDK are Google's, which means unfree and a licence
350 # to accept — so this is its own import of nixpkgs rather than the
351 # `legacyPackages` everything above uses. Confined to the Android
352 # outputs: `nix build` of frq itself never evaluates it.
353 #
Build the APK as derivations only, and retire the buck2 graph 3bc3aaa nandi 16d ago354 # The NDK here is r29, which is the one the pinned libvidya was
355 # built with.
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago356 androidPkgs = import nixpkgs {
357 inherit (pkgs.stdenv.hostPlatform) system;
358 config = {
359 allowUnfree = true;
360 android_sdk.accept_license = true;
361 };
362 };
363
364 androidComposition = androidPkgs.androidenv.composeAndroidPackages {
365 buildToolsVersions = [ "36.0.0" ];
366 platformVersions = [ "36" ];
367 includeNDK = true;
368 };
369
370 android = import ./nix/android.nix {
371 inherit pkgs self chez-src jolt-native glimmer joltAndroid;
372 inherit (pkgs) lib;
373 androidSdk = androidComposition.androidsdk;
374 ndk = androidComposition.ndk-bundle;
375 };
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago376 in
377 {
378 inherit native frq;
Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago379 inherit tui;
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago380 jolt = joltRuntime;
381 default = frq;
Bundle the closure into one file the AppImage runtime mounts f82b93f nandi 18d ago382
Take bb from the flake, so a checkout needs nix and nothing else 270bee0 nandi 16d ago383 # The interpreter scripts/ is written in, named here so that
384 # scripts/bb can build it. Nothing else in this flake uses it: it is
385 # an output because a shell script cannot ask for `nixpkgs#babashka`
386 # at the version this tree pins, and `.#bb` is exactly that.
387 bb = pkgs.babashka;
388
Bundle the closure into one file the AppImage runtime mounts f82b93f nandi 18d ago389 # frq and everything it loads, squashed into one runnable file for
390 # hosts without Nix. The whole closure rides along — Mesa included,
391 # which is not waste: off NixOS the launcher goes through nixGL, and
392 # nixGL needs a store Mesa to put the host's driver in front of.
393 appimage =
394 nix-appimage.bundlers.${pkgs.stdenv.hostPlatform.system}.default frq;
Build the APK from the flake, and from nothing 6aa2a6b nandi 18d ago395 }
396 # An APK is built by a linux-x86_64 NDK and a linux-x86_64 jolt, and
397 # Google ships no other; on aarch64 the Android outputs are simply
398 # absent rather than present and broken.
399 // lib.optionalAttrs (pkgs.stdenv.hostPlatform.system == "x86_64-linux") {
400 inherit (android) apk chezAndroid joltBoot libjoltapp;
401 apk-unsigned = android.apk-unsigned;
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago402 });
403
Run this tree on a native half the builders made a32699e nandi 17d ago404 # Where `just run` runs, and — because entering it realises what it
405 # names — what builds the half of frq that is not this working tree.
406 #
407 # The two halves, and the split is the whole point of the shell. The frq
408 # source is the files on disk, uncommitted edits and all. Everything
409 # under it — jolt, glimmer, glimmer-vidya, both native objects — is the
410 # flake's, at the revs flake.lock names, so a run says what it ran
411 # against and both halves of glimmer-vidya move together. That is the
412 # 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.
414 #
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.
424 #
425 # 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
427 # the shell with --max-jobs 0, which is what sends it to the `builders`
428 # entry rather than compiling egui on a laptop.
429 devShells = forEachSystem (pkgs:
430 let
431 inherit (pkgs) lib;
432 inherit (self.packages.${pkgs.stdenv.hostPlatform.system}) jolt native;
433 in
434 {
435 default = pkgs.mkShellNoCC {
436 name = "frq";
437
438 # jolt, because the runtime frq is run by should be the flake's
439 # too. nixGL for the same reason the launcher reaches for it — see
Take bb from the flake, so a checkout needs nix and nothing else 270bee0 nandi 16d ago440 # frqScript. babashka because scripts/bb prefers one on PATH, and
441 # inside here that should be this one rather than a second copy
Take just from the dev shell, so the host needs no copy of it 9afdfa4 nandi 16d ago442 # built through `.#bb`. just so the recipe runner comes from here
443 # too rather than the host — `nix develop` and then `just run` is
444 # the whole of what a machine with nix needs.
445 packages = [ jolt pkgs.babashka pkgs.just (nixGLFor pkgs) ];
Run this tree on a native half the builders made a32699e nandi 17d ago446
447 # Read by scripts/run.bb rather than baked into a wrapper: the frq
448 # source `just run` runs is the working tree, so the launcher has
449 # to be a script in that tree and the shell has to hand it its
450 # answers. Naming these is also what makes the shell build them.
451 JOLT_NATIVE_LIB = "${native}/lib";
452 GLIMMER_SRC = glimmer;
453 GLIMMER_VIDYA_SRC = "${jolt-native}/jolt/glimmer-vidya";
Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago454 GLIMMER_TUI_SRC = "${jolt-native}/jolt/glimmer-tui";
Run this tree on a native half the builders made a32699e nandi 17d ago455 FRQ_LIB_PATH = lib.makeLibraryPath (runtimeLibsFor pkgs);
456 NIXGL = "${nixGLFor pkgs}/bin/nixGLIntel";
457 };
458 });
459
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago460 apps = forEachSystem (pkgs: {
461 default = {
462 type = "app";
463 program = "${self.packages.${pkgs.stdenv.hostPlatform.system}.frq}/bin/frq";
464 };
Paint the same screens into a terminal ab83b42 nandi 17d ago465 tui = {
466 type = "app";
467 program = "${self.packages.${pkgs.stdenv.hostPlatform.system}.tui}/bin/frq-tui";
468 };
Build the client with Nix, not just a shell for it ca3afbe nandi 19d ago469 });
470 };
471}