nandi/frqpublic Fork 0
35e7155
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.

Run the app the way it is built: nix run

The old run.bb ran a bare `jolt -M:frq` with build/lib on the loader
path, which only worked after `just lib` had put the native release
there — a second way of assembling the app beside the flake's, and the
one that goes stale. `nix run .#frq` is the whole thing: the libraries,
the jolt runtime, the resolved graph, and the launcher that puts nixGL
in front off NixOS.

Nix is not on every host holding this checkout — on this one it lives in
the Arch distrobox — so a host without it is not an error, just the same
command one layer in. The worktree path is identical inside the
container, which is what lets the cd be the path verbatim.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-01T20:23:04-07:00 Browse files
35e7155 parent: da84772
modified scripts/run.bb +42 -10
@@ -3,17 +3,49 @@
33 exec "$(dirname "$0")/bb" "$0" "$@"
44 )
55
6-;; The app, with the native libraries `just lib` linked into build/lib on the
7-;; loader path. Those are jolt-native's release, fetched by digest; nothing
8-;; here looks for a checkout of it.
9-(require '[babashka.fs :as fs]
10- '[babashka.process :as p])
6+;; The app.
7+;;
8+;; run.bb [args...]
9+;;
10+;; `nix run .#frq`, which is the whole build: the native libraries, the jolt
11+;; runtime, the dependency graph, and a launcher that puts nixGL in front off
12+;; NixOS so the window opens. Nothing here needs `just lib` first.
13+;;
14+;; Nix is not on every host that has this checkout — on the developer's it
15+;; lives in the Arch distrobox — so a host without it is not an error, it is
16+;; the same command run one layer in. The worktree path is the same inside the
17+;; container as outside, which is what lets the `cd` be this path verbatim.
18+(require '[babashka.classpath :as cp])
19+(cp/add-classpath (str (babashka.fs/parent *file*)))
20+(require '[frq.paths :as paths]
21+ '[babashka.fs :as fs]
22+ '[babashka.process :as p]
23+ '[clojure.string :as str])
1124
1225 (def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
26+(def box (paths/env "FRQ_DISTROBOX" "arch"))
27+
28+(defn quote-arg
29+ "One argument, safe for a shell that will read the whole line as a string."
30+ [s]
31+ (str "'" (str/replace (str s) "'" "'\\''") "'"))
32+
33+;; `--` and then the args: everything past it is the app's, not nix's.
34+(def nix-args
35+ (concat ["nix" "run" ".#frq"]
36+ (when (seq *command-line-args*) (cons "--" *command-line-args*))))
37+
38+(def command
39+ (if (fs/which "nix")
40+ (cons {:dir root} nix-args)
41+ (do
42+ (when-not (fs/which "distrobox")
43+ (paths/die "no nix and no distrobox — install nix, or set FRQ_DISTROBOX"
44+ "to a container that has it."))
45+ [{} "distrobox" "enter" box "--"
46+ "bash" "-lc" (str "cd " (quote-arg root) " && "
47+ (str/join " " (map quote-arg nix-args)))])))
1348
1449 (System/exit
15- (:exit @(apply p/process
16- {:inherit true
17- :extra-env {"LD_LIBRARY_PATH"
18- (str (fs/path root "build" "lib"))}}
19- "jolt" "-M:frq" *command-line-args*)))
50+ (:exit @(apply p/process (assoc (first command) :inherit true)
51+ (rest command))))
@@ -3,17 +3,49 @@
3 exec "$(dirname "$0")/bb" "$0" "$@"3 exec "$(dirname "$0")/bb" "$0" "$@"
4 )4 )
5 5
6-;; The app, with the native libraries `just lib` linked into build/lib on the6+;; The app.
7-;; loader path. Those are jolt-native's release, fetched by digest; nothing7+;;
8-;; here looks for a checkout of it.8+;; run.bb [args...]
9-(require '[babashka.fs :as fs]9+;;
10- '[babashka.process :as p])10+;; `nix run .#frq`, which is the whole build: the native libraries, the jolt
11+;; runtime, the dependency graph, and a launcher that puts nixGL in front off
12+;; NixOS so the window opens. Nothing here needs `just lib` first.
13+;;
14+;; Nix is not on every host that has this checkout — on the developer's it
15+;; lives in the Arch distrobox — so a host without it is not an error, it is
16+;; the same command run one layer in. The worktree path is the same inside the
17+;; container as outside, which is what lets the `cd` be this path verbatim.
18+(require '[babashka.classpath :as cp])
19+(cp/add-classpath (str (babashka.fs/parent *file*)))
20+(require '[frq.paths :as paths]
21+ '[babashka.fs :as fs]
22+ '[babashka.process :as p]
23+ '[clojure.string :as str])
11 24
12 (def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))25 (def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
26+(def box (paths/env "FRQ_DISTROBOX" "arch"))
27+
28+(defn quote-arg
29+ "One argument, safe for a shell that will read the whole line as a string."
30+ [s]
31+ (str "'" (str/replace (str s) "'" "'\\''") "'"))
32+
33+;; `--` and then the args: everything past it is the app's, not nix's.
34+(def nix-args
35+ (concat ["nix" "run" ".#frq"]
36+ (when (seq *command-line-args*) (cons "--" *command-line-args*))))
37+
38+(def command
39+ (if (fs/which "nix")
40+ (cons {:dir root} nix-args)
41+ (do
42+ (when-not (fs/which "distrobox")
43+ (paths/die "no nix and no distrobox — install nix, or set FRQ_DISTROBOX"
44+ "to a container that has it."))
45+ [{} "distrobox" "enter" box "--"
46+ "bash" "-lc" (str "cd " (quote-arg root) " && "
47+ (str/join " " (map quote-arg nix-args)))])))
13 48
14 (System/exit49 (System/exit
15- (:exit @(apply p/process50+ (:exit @(apply p/process (assoc (first command) :inherit true)
16- {:inherit true51+ (rest command))))
17- :extra-env {"LD_LIBRARY_PATH"
18- (str (fs/path root "build" "lib"))}}
19- "jolt" "-M:frq" *command-line-args*)))