Adding a Common Lisp wrapper.
Features: + configurable via environment variables + can skip the actual launching of the lisp implementation (source it with NIX_LISP_SKIP_CODE=1 to get all the settings) + currently supports SBCL, CLisp, ECL + determines lisp implementation from NIX_LISP_COMMAND variable or from buildInputs + sets ASDF search path for packages using buildInputs
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
NIX_LISP_ASDF="@asdf@"
|
||||
|
||||
CL_SOURCE_REGISTRY="@asdf@/lib/common-lisp/asdf/:@asdf@/lib/common-lisp/asdf/uiop/"
|
||||
|
||||
addASDFPaths () {
|
||||
for j in "$1"/lib/common-lisp/*; do
|
||||
if [ -d "$j" ]; then
|
||||
CL_SOURCE_REGISTRY="$CL_SOURCE_REGISTRY:$j/"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
setLisp () {
|
||||
if [ -z "$NIX_LISP_COMMAND" ]; then
|
||||
for j in "$1"/bin/*; do
|
||||
case "$(basename "$j")" in
|
||||
sbcl) NIX_LISP_COMMAND="$j" ;;
|
||||
ecl) NIX_LISP_COMMAND="$j" ;;
|
||||
clisp) NIX_LISP_COMMAND="$j" ;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
if [ -z "$NIX_LISP" ]; then
|
||||
NIX_LISP="${NIX_LISP_COMMAND##*/}"
|
||||
fi
|
||||
}
|
||||
|
||||
export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF
|
||||
|
||||
envHooks=(envHooks[@] addASDFPaths setLisp)
|
||||
|
||||
mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home"
|
||||
mkdir -p "$HOME"/.cache/common-lisp
|
||||
Reference in New Issue
Block a user