nandi/frqpublic Fork 0
4f04b910c974db5746fb6143b2f89abfa07d827d
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 source on disk, not the source in git 66ba416 · on 4f04b910c974db5746fb6143b2f89abfa07d827d · nandi · 17d ago
run.bb · 43 lines · 1.8 KBBlitzBasic Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
#_(
exec "$(dirname "$0")/bb" "$0" "$@"
)

;; The app, from this working tree.
;;
;;   run.bb [args...]
;;
;; Everything but the source is pinned: jolt comes from scripts/jolt.dotslash
;; and the two native libraries from scripts/lib*.dotslash, fetched by digest
;; and linked into build/lib, which is the one directory the loader is pointed
;; at. `just lib` is done here rather than asked for — the pins say what those
;; bytes are, so there is nothing for a person to decide before running.
;;
;; Deliberately not `nix run .#frq`. That builds the flake's own copy of the
;; source, which is the tree as git has it — so an edit that has not been
;; committed, or has been committed on a branch the command was not pointed at,
;; runs as whatever was there before, silently. A run that is meant to answer
;; "does my change work" has to be the files on disk.
(require '[babashka.fs :as fs]
         '[babashka.process :as p])

(def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
(def lib (str (fs/path root "build" "lib")))

;; The pinned jolt — scripts/jolt is a DotSlash script, so running it is
;; fetching it. Off linux-x86_64 the pin has no asset and the fallback is
;; whatever `jolt` is on PATH, which is what that manifest says to do.
(def jolt
  (let [pin (fs/path root "scripts" "jolt")]
    (if (and (fs/exists? pin) (fs/which "dotslash")) (str pin) "jolt")))

(p/shell (str (fs/path root "scripts" "lib.bb")))

(System/exit
 (:exit @(apply p/process
                {:inherit true
                 :dir root
                 :extra-env {"LD_LIBRARY_PATH"
                             (str lib (when-let [p (System/getenv "LD_LIBRARY_PATH")]
                                        (str ":" p)))}}
                jolt "-M:frq" *command-line-args*)))