nandi/frqpublic Fork 0
d6bf5a774692227596a51097aa4f165ea15e77a2
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.bb · 43 lines · 1.8 KBBlitzBasic Blame HistoryRaw
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago1#!/bin/sh
2#_(
3exec "$(dirname "$0")/bb" "$0" "$@"
4)
5
Run the source on disk, not the source in git 66ba416 nandi 17d ago6;; The app, from this working tree.
Run the app the way it is built: nix run 35e7155 nandi 17d ago7;;
8;; run.bb [args...]
9;;
Run the source on disk, not the source in git 66ba416 nandi 17d ago10;; Everything but the source is pinned: jolt comes from scripts/jolt.dotslash
11;; and the two native libraries from scripts/lib*.dotslash, fetched by digest
12;; and linked into build/lib, which is the one directory the loader is pointed
13;; at. `just lib` is done here rather than asked for — the pins say what those
14;; bytes are, so there is nothing for a person to decide before running.
Run the app the way it is built: nix run 35e7155 nandi 17d ago15;;
Run the source on disk, not the source in git 66ba416 nandi 17d ago16;; Deliberately not `nix run .#frq`. That builds the flake's own copy of the
17;; source, which is the tree as git has it — so an edit that has not been
18;; committed, or has been committed on a branch the command was not pointed at,
19;; runs as whatever was there before, silently. A run that is meant to answer
20;; "does my change work" has to be the files on disk.
21(require '[babashka.fs :as fs]
22 '[babashka.process :as p])
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago23
24(def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
Run the source on disk, not the source in git 66ba416 nandi 17d ago25(def lib (str (fs/path root "build" "lib")))
Run the app the way it is built: nix run 35e7155 nandi 17d ago26
Run the source on disk, not the source in git 66ba416 nandi 17d ago27;; The pinned jolt — scripts/jolt is a DotSlash script, so running it is
28;; fetching it. Off linux-x86_64 the pin has no asset and the fallback is
29;; whatever `jolt` is on PATH, which is what that manifest says to do.
30(def jolt
31 (let [pin (fs/path root "scripts" "jolt")]
32 (if (and (fs/exists? pin) (fs/which "dotslash")) (str pin) "jolt")))
Run the app the way it is built: nix run 35e7155 nandi 17d ago33
Run the source on disk, not the source in git 66ba416 nandi 17d ago34(p/shell (str (fs/path root "scripts" "lib.bb")))
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago35
36(System/exit
Run the source on disk, not the source in git 66ba416 nandi 17d ago37 (:exit @(apply p/process
38 {:inherit true
39 :dir root
40 :extra-env {"LD_LIBRARY_PATH"
41 (str lib (when-let [p (System/getenv "LD_LIBRARY_PATH")]
42 (str ":" p)))}}
43 jolt "-M:frq" *command-line-args*)))