quicklisp (lispPackages.quicklisp): init

This commit is contained in:
Michael Raskin 2016-03-25 17:57:45 +01:00
parent 98e8696290
commit 511ad5e5bf
4 changed files with 116 additions and 1 deletions

View File

@ -19,16 +19,19 @@ case "$NIX_LISP" in
sbcl) sbcl)
NIX_LISP_LOAD_FILE="--load" NIX_LISP_LOAD_FILE="--load"
NIX_LISP_EXEC_CODE="--eval" NIX_LISP_EXEC_CODE="--eval"
NIX_LISP_QUIT="(quit)"
NIX_LISP_FINAL_PARAMETERS= NIX_LISP_FINAL_PARAMETERS=
;; ;;
ecl) ecl)
NIX_LISP_LOAD_FILE="-load" NIX_LISP_LOAD_FILE="-load"
NIX_LISP_EXEC_CODE="-eval" NIX_LISP_EXEC_CODE="-eval"
NIX_LISP_QUIT="(quit)"
NIX_LISP_FINAL_PARAMETERS= NIX_LISP_FINAL_PARAMETERS=
;; ;;
clisp) clisp)
NIX_LISP_LOAD_FILE="-c -l" NIX_LISP_LOAD_FILE="-c -l"
NIX_LISP_EXEC_CODE="-x" NIX_LISP_EXEC_CODE="-x"
NIX_LISP_QUIT="(quit)"
NIX_LISP_FINAL_PARAMETERS="-repl" NIX_LISP_FINAL_PARAMETERS="-repl"
;; ;;
esac esac

View File

@ -1,3 +1,3 @@
#! /bin/sh #! /bin/sh
"$(dirname "$0")"/cl-wrapper.sh "${NIX_LISP_COMMAND:-$(ls "@lisp@/bin"/* | head -n 1)}" "$@" source "@out@"/bin/cl-wrapper.sh "${NIX_LISP_COMMAND:-$(ls "@lisp@/bin"/* | head -n 1)}" "$@"

View File

@ -575,5 +575,32 @@ let lispPackages = rec {
}; };
}; };
quicklisp = buildLispPackage rec {
baseName = "quicklisp";
version = "2016-01-21";
description = "The Common Lisp package manager";
deps = [];
src = pkgs.fetchgit {
url = "https://github.com/quicklisp/quicklisp-client/";
rev = "refs/tags/version-${version}";
sha256 = "0a6zjsd5c8zg2x26lc027538xfl182xvg7ps81pyvi4k5qd42xhd";
};
overrides = x: rec {
inherit clwrapper;
quicklispdist = pkgs.fetchurl {
# Will usually be replaced with a fresh version anyway, but needs to be
# a valid distinfo.txt
url = "http://beta.quicklisp.org/dist/quicklisp/2016-03-18/distinfo.txt";
sha256 = "13mvign4rsicfvg3vs3vj1qcjvj2m1aqhq93ck0sgizxfcj5167m";
};
buildPhase = '' true; '';
postInstall = ''
substituteAll ${./quicklisp.sh} "$out"/bin/quicklisp
chmod a+x "$out"/bin/quicklisp
cp "${quicklispdist}" "$out/lib/common-lisp/quicklisp/quicklisp-distinfo.txt"
'';
};
};
}; };
in lispPackages in lispPackages

View File

@ -0,0 +1,85 @@
#! /usr/bin/env bash
op=
end_param=
args=()
cmd_args=()
while let "$#"; do
if test -n "$end_param" || test "$1" = "${1#--}"; then
if test -n "$op"; then
args[${#args[@]}]="$1";
else
op="$1"
fi
shift
else
case "$1" in
--)
end_param=1; shift;
;;
--quicklisp-dir)
NIX_QUICKLISP_DIR="$2";
shift; shift;
;;
--help)
echo "Operation: init, run, update, install {system-name}"
exit 0;
;;
*)
echo "Unknown parameter [$1]" >&2
exit 2;
;;
esac
fi
done
NIX_QUICKLISP_DIR="${NIX_QUICKLISP_DIR:-${HOME}/quicklisp}"
case "$op" in
'') echo "Specify an operation: init, install, run, update"
;;
install)
NIX_LISP_SKIP_CODE=1 source "@clwrapper@/bin/common-lisp.sh";
cmd_args[${#cmd_args[@]}]="$NIX_LISP_EXEC_CODE"
cmd_args[${#cmd_args[@]}]="(load \"$NIX_QUICKLISP_DIR/setup.lisp\")"
for i in "${args[@]}"; do
cmd_args[${#cmd_args[@]}]="$NIX_LISP_EXEC_CODE"
cmd_args[${#cmd_args[@]}]="(ql:quickload :$i)"
done
cmd_args[${#cmd_args[@]}]="$NIX_LISP_EXEC_CODE"
cmd_args[${#cmd_args[@]}]="$NIX_LISP_QUIT"
"@clwrapper@/bin/common-lisp.sh" "${cmd_args[@]}"
;;
update)
NIX_LISP_SKIP_CODE=1 source "@clwrapper@/bin/common-lisp.sh"
ln -sfT "@out@/lib/common-lisp/quicklisp/asdf.lisp" "$NIX_QUICKLISP_DIR/asdf.lisp"
cp -f "@out@/lib/common-lisp/quicklisp/setup.lisp" "$NIX_QUICKLISP_DIR/setup.lisp"
if test -d "$NIX_QUICKLISP_DIR/quicklisp"; then
mv "$NIX_QUICKLISP_DIR/quicklisp"{,-old-$(date +%Y%m%d-%H%M%S)}
fi
ln -sfT "@out@/lib/common-lisp/quicklisp/quicklisp" "$NIX_QUICKLISP_DIR/quicklisp"
"@clwrapper@/bin/common-lisp.sh" "$NIX_LISP_EXEC_CODE" \
"(load \"$NIX_QUICKLISP_DIR/setup.lisp\")" "$NIX_LISP_EXEC_CODE" \
"(ql:update-all-dists)" "$NIX_LISP_EXEC_CODE" "$NIX_LISP_QUIT"
;;
init)
mkdir -p "$NIX_QUICKLISP_DIR"/{dists/quicklisp,tmp,local-projects}
echo 1 > "$NIX_QUICKLISP_DIR/dists/quicklisp/enabled.txt"
cp -f "@out@/lib/common-lisp/quicklisp/quicklisp-distinfo.txt" \
"$NIX_QUICKLISP_DIR/dists/quicklisp/distinfo.txt"
NIX_QUICKLISP_DIR="$NIX_QUICKLISP_DIR" "$0" update
;;
run)
NIX_LISP_SKIP_CODE=1 source "@clwrapper@/bin/common-lisp.sh"
"@clwrapper@/bin/common-lisp.sh" "$NIX_LISP_EXEC_CODE" \
"(load \"$NIX_QUICKLISP_DIR/setup.lisp\")" "${args[@]}"
;;
esac