summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-07-21 09:11:15 -0400
committerBen Sima <ben@bsima.me>2022-07-21 09:11:15 -0400
commit6c954007ed45aead42719a76ab38333f989f759e (patch)
tree326c42bd1c97d8ad20f325b919f314affd0b1120
parent710fd36b32fdf61c5858fd8d7f47891f07fa90d9 (diff)
Add sysdeps to repl environments
-rwxr-xr-xBiz/Ide/repl10
1 files changed, 8 insertions, 2 deletions
diff --git a/Biz/Ide/repl b/Biz/Ide/repl
index 2ddbc4b..cf800aa 100755
--- a/Biz/Ide/repl
+++ b/Biz/Ide/repl
@@ -20,28 +20,34 @@ fi
targets=${@:?}
json=$(bild --json ${targets[@]})
langdeps=$(jq --raw-output '.langdeps | join(" ")' <<< $json)
+ sysdeps=$(jq --raw-output '.sysdeps | join(" ")' <<< $json)
exts=$(jq --raw-output '.namespace.ext' <<< $json | sort | uniq)
+ flags=()
+ for lib in ${sysdeps[@]}; do
+ flags+=(--packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.nixpkgs.${lib}")
+ done
case $exts in
Hs)
if [ -z ${var+PORT} ]; then
echo "warn: repl: ghci does not support binding to a port"
fi
nix-shell \
+ "${flags[@]}" \
--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)
- flags=()
for lib in ${langdeps[@]}; do
flags+=(--packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.nixpkgs.guile-${lib}")
done
nix-shell \
+ "${flags[@]}" \
--packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.nixpkgs.guile_3_0" \
- ${flags[@]} \
--command "guile -L $BIZ_ROOT -C $BIZ_ROOT/_/int --r7rs --listen=${PORT:-37146}"
;;
Lisp)
nix-shell \
+ "${flags[@]}" \
--packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.sbclWith (p: with p; [asdf swank $langdeps])" \
--command "sbcl --eval '(require :asdf)' --eval '(require :swank)' --eval '(swank:create-server :port ${PORT:-4005})' --load $targets"
;;