Skip to content

Commit

Permalink
lispPackages: load precompiled asdf; support more implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
7c6f434c committed Apr 9, 2017
1 parent b64163a commit 58d6b50
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
31 changes: 29 additions & 2 deletions pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh
@@ -1,6 +1,6 @@
#!@stdenv_shell@
# Part of NixPkgs package collection
# This script can be used at your option under the same license as NixPkgs or
# This script can be used at your option under the same license as NixPkgs or
# under MIT/X11 license

eval "$NIX_LISP_PREHOOK"
Expand All @@ -24,20 +24,47 @@ case "$NIX_LISP" in
NIX_LISP_QUIT="(quit)"
NIX_LISP_NODEBUG='--non-interactive'
NIX_LISP_FINAL_PARAMETERS=
NIX_LISP_FASL_TYPE="fasl"
;;
ecl)
NIX_LISP_LOAD_FILE="-load"
NIX_LISP_EXEC_CODE="-eval"
NIX_LISP_QUIT="(quit)"
NIX_LISP_NODEBUG='--nodebug'
NIX_LISP_FINAL_PARAMETERS=
NIX_LISP_FASL_TYPE="fas"
;;
clisp)
NIX_LISP_LOAD_FILE="-c -l"
NIX_LISP_EXEC_CODE="-x"
NIX_LISP_QUIT="(quit)"
NIX_LISP_NODEBUG='-on-error exit'
NIX_LISP_FINAL_PARAMETERS="-repl"
NIX_LISP_FASL_TYPE="fas"
;;
lx86cl64)
NIX_LISP_LOAD_FILE="-l"
NIX_LISP_EXEC_CODE="-e"
NIX_LISP_QUIT="(quit)"
NIX_LISP_NODEBUG='-b'
NIX_LISP_FINAL_PARAMETERS=
NIX_LISP_FASL_TYPE="lx64fsl"
;;
lx86cl)
NIX_LISP_LOAD_FILE="-l"
NIX_LISP_EXEC_CODE="-e"
NIX_LISP_QUIT="(quit)"
NIX_LISP_NODEBUG='-b'
NIX_LISP_FINAL_PARAMETERS=
NIX_LISP_FASL_TYPE="lx32fsl"
;;
abcl)
NIX_LISP_LOAD_FILE="--load"
NIX_LISP_EXEC_CODE="--eval"
NIX_LISP_QUIT="(quit)"
NIX_LISP_NODEBUG=''
NIX_LISP_FINAL_PARAMETERS=
NIX_LISP_FASL_TYPE="abcl"
;;
esac

Expand All @@ -59,7 +86,7 @@ nix_lisp_run_single_form(){
eval "$NIX_LISP_PRELAUNCH_HOOK"

[ -z "$NIX_LISP_SKIP_CODE" ] && "$NIX_LISP_COMMAND" $NIX_LISP_EARLY_OPTIONS \
$NIX_LISP_EXEC_CODE "${NIX_LISP_ASDF_LOAD:-"(load \"$NIX_LISP_ASDF/lib/common-lisp/asdf/build/asdf.lisp\")"}" \
$NIX_LISP_EXEC_CODE "${NIX_LISP_ASDF_LOAD:-"(load \"$NIX_LISP_ASDF/lib/common-lisp/asdf/build/asdf.$NIX_LISP_FASL_TYPE\")"}" \
$NIX_LISP_EXEC_CODE "$NIX_LISP_ASDF_REGISTRY_CODE" \
${NIX_LISP_FINAL_PARAMETERS[*]:+"${NIX_LISP_FINAL_PARAMETERS[@]}"} \
"$@"
6 changes: 4 additions & 2 deletions pkgs/development/lisp-modules/clwrapper/default.nix
Expand Up @@ -12,7 +12,7 @@ stdenv.mkDerivation {
substituteAll "${./build-with-lisp.sh}" "$out/bin/build-with-lisp.sh"
substituteAll "${./cl-wrapper.sh}" "$out/bin/cl-wrapper.sh"
chmod a+x "$out"/bin/*
substituteAll "${./setup-hook.sh}" "setup-hook-parsed"
source setup-hook-parsed
setLisp "${lisp}"
Expand All @@ -22,7 +22,9 @@ stdenv.mkDerivation {
cp -r "${asdf}/lib/common-lisp"/* "$out/lib/common-lisp/"
chmod u+rw -R "$out/lib/common-lisp/"
NIX_LISP_PRELAUNCH_HOOK='nix_lisp_run_single_form "(progn
NIX_LISP_PRELAUNCH_HOOK='
NIX_LISP_FASL_TYPE=lisp
nix_lisp_run_single_form "(progn
(uiop/lisp-build:compile-file* \"'"$out"'/lib/common-lisp/asdf/build/asdf.lisp\")
(asdf:load-system :uiop :force :all)
(asdf:load-system :asdf :force :all)
Expand Down
8 changes: 4 additions & 4 deletions pkgs/development/lisp-modules/define-package.nix
@@ -1,7 +1,7 @@
args @ {stdenv, clwrapper, baseName, testSystems ? [baseName], version ? "latest"
, src, description, deps, buildInputs ? [], meta ? {}, overrides?(x: {})
, propagatedBuildInputs ? []}:
let
let
deployConfigScript = ''
outhash="$out"
outhash="''${outhash##*/}"
Expand Down Expand Up @@ -39,7 +39,7 @@ let
echo "#! /bin/sh" >> "$launch_script"
echo "source '$config_script'" >> "$launch_script"
echo "export LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH\"" >> "$launch_script"
echo '"${clwrapper}/bin/common-lisp.sh" "$@"' >> "$launch_script"
echo '"${clwrapper}/bin/common-lisp.sh" "$@"' >> "$launch_script"
'';
basePackage = {
name = "lisp-${baseName}-${version}";
Expand All @@ -66,12 +66,12 @@ basePackage = {
(asdf:operate (quote asdf::compile-bundle-op) :${testSystem})
(ignore-errors (asdf:operate (quote asdf::deploy-asd-op) :${testSystem}))
)"' \
"$out/bin/${args.baseName}-lisp-launcher.sh" ""
"$out/bin/${args.baseName}-lisp-launcher.sh"
'') testSystems}
eval "$postInstall"
'';
propagatedBuildInputs = (args.deps or []) ++ [clwrapper clwrapper.lisp clwrapper.asdf]
propagatedBuildInputs = (args.deps or []) ++ [clwrapper clwrapper.lisp clwrapper.asdf]
++ (args.propagatedBuildInputs or []);
buildInputs = buildInputs;
dontStrip=true;
Expand Down

0 comments on commit 58d6b50

Please sign in to comment.