summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-07-20 10:24:04 -0400
committerBen Sima <ben@bsima.me>2022-07-20 10:24:04 -0400
commit7dd2fccd5f1d5ddefa18e9a25c16724ceb54a909 (patch)
treedb9348c1586b7cca88d9c0047d5557b6caf8626b
parent056902258d73ba4a896325f5cf544f075d5a9efd (diff)
Provision scheme environments with nix
There's no `guileWith` in nixpkgs, so I think I just need to pass multiple `--packages` flags. I can't test this yet because I need to implement import detection in Bild.hs first, but that's less important because Guile ships with a bunch of SRFIs, which is nice, and anyway there aren't many Guile libraries in nixpkgs for me to pull from.
-rwxr-xr-xBiz/Ide/repl18
1 files changed, 12 insertions, 6 deletions
diff --git a/Biz/Ide/repl b/Biz/Ide/repl
index 7c2e15c..dfd8c3d 100755
--- a/Biz/Ide/repl
+++ b/Biz/Ide/repl
@@ -14,18 +14,24 @@
exts=$(jq --raw-output '.namespace.ext' <<< $json | sort | uniq)
case $exts in
Hs)
- nix-shell \
- --packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.ghcWith (h: with h; [$langdeps])" \
- --command "ghci -i$BIZ_ROOT -ghci-script $BIZ_ROOT/.ghci ${targets[@]}"
+ nix-shell \
+ --packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.ghcWith (h: with h; [$langdeps])" \
+ --command "ghci -i$BIZ_ROOT -ghci-script $BIZ_ROOT/.ghci ${targets[@]}"
;;
Scm)
- echo "scheme repl not supported yet: $target"
- exit 1
+ flags=()
+ for lib in ${langdeps[@]}; do
+ flags+=(--packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.nixpkgs.guile-${lib}")
+ done
+ nix-shell \
+ --packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.nixpkgs.guile_3_0" \
+ ${flags[@]} \
+ --command "guile -L $BIZ_ROOT -C $BIZ_ROOT/_/int --r7rs --listen"
;;
Lisp)
nix-shell \
--packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.sbclWith (p: with p; [asdf swank $langdeps])" \
- --run "sbcl --eval '(require :asdf)' --eval '(require :swank)' --eval '(swank:create-server)' --load $targets"
+ --command "sbcl --eval '(require :asdf)' --eval '(require :swank)' --eval '(swank:create-server)' --load $targets"
;;
*)
echo "unsupported targets: ${targets[@]}"