Skip to content

Commit

Permalink
quicklispPackages: update to fresh QuickLisp
Browse files Browse the repository at this point in the history
lispPackages: reduce environment-bombing
  • Loading branch information
7c6f434c committed Apr 6, 2017
1 parent 09b1414 commit 365e8a7
Show file tree
Hide file tree
Showing 162 changed files with 1,391 additions and 720 deletions.
2 changes: 1 addition & 1 deletion pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh
Expand Up @@ -49,7 +49,7 @@ NIX_LISP_ASDF_REGISTRY_CODE="
)
"

NIX_LISP_ASDF="${NIX_LISP_ASDF:-@asdf@}"
NIX_LISP_ASDF="${NIX_LISP_ASDF:-@out@}"

nix_lisp_run_single_form(){
NIX_LISP_FINAL_PARAMETERS=("$NIX_LISP_EXEC_CODE" "$1"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/lisp-modules/clwrapper/common-lisp.sh
@@ -1,3 +1,3 @@
#! /bin/sh

source "@out@"/bin/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)}" "$@"
21 changes: 13 additions & 8 deletions pkgs/development/lisp-modules/clwrapper/default.nix
@@ -1,11 +1,13 @@
{stdenv, fetchurl, asdf, lisp ? null}:
{stdenv, fetchurl, asdf, which, lisp ? null}:
stdenv.mkDerivation {
name = "cl-wrapper-script";

buildPhase="";

installPhase=''
mkdir -p "$out"/bin
export head="$(which head)"
export ls="$(which ls)"
substituteAll ${./common-lisp.sh} "$out"/bin/common-lisp.sh
substituteAll "${./build-with-lisp.sh}" "$out/bin/build-with-lisp.sh"
substituteAll "${./cl-wrapper.sh}" "$out/bin/cl-wrapper.sh"
Expand All @@ -16,28 +18,31 @@ stdenv.mkDerivation {
setLisp "${lisp}"
echo "$NIX_LISP"
ASDF_OUTPUT_TRANSLATIONS="${asdf}/lib/common-lisp/:$out/lib/common-lisp-compiled/" \
mkdir -p "$out/lib/common-lisp/"
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
(uiop/lisp-build:compile-file* \"${asdf}/lib/common-lisp/asdf/build/asdf.lisp\")
(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)
)"' \
"$out/bin/common-lisp.sh" "$NIX_LISP"
ln -s "$out/lib/common-lisp-compiled"/{asdf/uiop,uiop}
"$out/bin/common-lisp.sh"
'';

buildInputs = [which];

inherit asdf lisp;
stdenv_shell = stdenv.shell;

setupHook = ./setup-hook.sh;

phases="installPhase fixupPhase";

preferLocalBuild = true;
ASDF_OUTPUT_TRANSLATIONS="${builtins.storeDir}/:${builtins.storeDir}";

passthru = {
inherit lisp asdf;
inherit lisp;
};

meta = {
Expand Down
16 changes: 5 additions & 11 deletions pkgs/development/lisp-modules/clwrapper/setup-hook.sh
@@ -1,16 +1,10 @@
NIX_LISP_ASDF="@asdf@"
NIX_LISP_ASDF="@out@"

CL_SOURCE_REGISTRY="${CL_SOURCE_REGISTRY:+$CL_SOURCE_REGISTRY:}@asdf@/lib/common-lisp/asdf/:@asdf@/lib/common-lisp/asdf/uiop/"
ASDF_OUTPUT_TRANSLATIONS="@asdf@/lib/common-lisp/:@out@/lib/common-lisp-compiled/"
CL_SOURCE_REGISTRY="${CL_SOURCE_REGISTRY:+$CL_SOURCE_REGISTRY:}@out@/lib/common-lisp/asdf/"

addASDFPaths () {
for j in "$1"/lib/common-lisp/*; do
if [ -d "$j" ]; then
CL_SOURCE_REGISTRY="$j/:$CL_SOURCE_REGISTRY"
if [ -d "$(dirname "$(dirname "$j")")/common-lisp-compiled/$(basename "$j")" ]; then
ASDF_OUTPUT_TRANSLATIONS="$j:$(dirname "$(dirname "$j")")/common-lisp-compiled/$(basename "$j")${ASDF_OUTPUT_TRANSLATIONS:+:}$ASDF_OUTPUT_TRANSLATIONS"
fi
fi
for j in "$1"/lib/common-lisp-settings/*-path-config.sh; do
source "$j"
done
}

Expand All @@ -35,7 +29,7 @@ collectNixLispLDLP () {
fi
}

export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF ASDF_OUTPUT_TRANSLATIONS
export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF

envHooks+=(addASDFPaths setLisp collectNixLispLDLP)

Expand Down
33 changes: 27 additions & 6 deletions pkgs/development/lisp-modules/define-package.nix
Expand Up @@ -3,19 +3,33 @@ args @ {stdenv, clwrapper, baseName, testSystems ? [baseName], version ? "latest
, propagatedBuildInputs ? []}:
let
deployConfigScript = ''
outhash="$out"
outhash="''${outhash##*/}"
outhash="''${outhash%%-*}"
config_script="$out"/lib/common-lisp-settings/${args.baseName}-shell-config.sh
path_config_script="$out"/lib/common-lisp-settings/${args.baseName}-path-config.sh
store_translation="$(dirname "$out"):$(dirname "$out")"
mkdir -p "$(dirname "$config_script")"
touch "$config_script"
touch "$path_config_script"
chmod a+x "$config_script"
chmod a+x "$path_config_script"
echo "if test -z \"\''${_''${outhash}_NIX_LISP_CONFIG}\"; then export _''${outhash}_NIX_LISP_CONFIG=1; " >> "$config_script"
echo "export NIX_CFLAGS_COMPILE='$NIX_CFLAGS_COMPILE'\"\''${NIX_CFLAGS_COMPILE:+ \$NIX_CFLAGS_COMPILE}\"" >> "$config_script"
echo "export NIX_LDFLAGS='$NIX_LDFLAGS'\"\''${NIX_LDFLAGS:+ \$NIX_LDFLAGS}\"" >> "$config_script"
echo "export NIX_LISP_COMMAND='$NIX_LISP_COMMAND'" >> "$config_script"
echo "export NIX_LISP_ASDF='$NIX_LISP_ASDF'" >> "$config_script"
echo "export CL_SOURCE_REGISTRY="\$CL_SOURCE_REGISTRY\''${CL_SOURCE_REGISTRY:+:}"'$out/lib/common-lisp/${args.baseName}/:$CL_SOURCE_REGISTRY'" >> "$config_script"
echo "export ASDF_OUTPUT_TRANSLATIONS="\$ASDF_OUTPUT_TRANSLATIONS\''${ASDF_OUTPUT_TRANSLATIONS:+:}"'$out/lib/common-lisp/${args.baseName}/:$out/lib/common-lisp-compiled/${args.baseName}:$ASDF_OUTPUT_TRANSLATIONS'" >> "$config_script"
echo "export PATH=\"\''${PATH:+\$PATH:}$PATH\"" >> "$config_script"
echo "echo \"\$ASDF_OUTPUT_TRANSLATIONS\" | grep -E '(^|:)$store_translation(:|\$)' >/dev/null || export ASDF_OUTPUT_TRANSLATIONS=\"\''${ASDF_OUTPUT_TRANSLATIONS:+\$ASDF_OUTPUT_TRANSLATIONS:}\"'$store_translation'" >> "$config_script"
echo "source '$path_config_script'" >> "$config_script"
echo "fi" >> "$config_script"
echo "if test -z \"\''${_''${outhash}_NIX_LISP_PATH_CONFIG}\"; then export _''${outhash}_NIX_LISP_PATH_CONFIG=1; " >> "$path_config_script"
echo "for i in \"''${CL_SOURCE_REGISTRY//:/\" \"}\" \"$out/lib/common-lisp/${args.baseName}/\" ; do echo \"\$CL_SOURCE_REGISTRY\" | grep -E \"(^|:)\$i(:|\\\$)\" >/dev/null || export CL_SOURCE_REGISTRY=\"\$CL_SOURCE_REGISTRY\''${CL_SOURCE_REGISTRY:+:}\$i\"; done;" >> "$path_config_script"
test -n "$LD_LIBRARY_PATH" &&
echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH\''${LD_LIBRARY_PATH:+:}\"'$LD_LIBRARY_PATH'" >> "$config_script"
echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH\''${LD_LIBRARY_PATH:+:}\"'$LD_LIBRARY_PATH'" >> "$path_config_script"
test -n "$NIX_LISP_LD_LIBRARY_PATH" &&
echo "export NIX_LISP_LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\"'$NIX_LISP_LD_LIBRARY_PATH'" >> "$config_script"
echo "export NIX_LISP_LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\"'$NIX_LISP_LD_LIBRARY_PATH'" >> "$path_config_script"
echo "fi" >> "$path_config_script"
'';
deployLaunchScript = ''
launch_script="$out"/bin/${args.baseName}-lisp-launcher.sh
Expand Down Expand Up @@ -44,9 +58,14 @@ basePackage = {
${deployLaunchScript}
${stdenv.lib.concatMapStrings (testSystem: ''
CL_SOURCE_REGISTRY= \
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK='nix_lisp_run_single_form "(progn
(asdf:compile-system :${testSystem}) (asdf:load-system :${testSystem}))"' \
(asdf:compile-system :${testSystem})
(asdf:load-system :${testSystem})
(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" ""
'') testSystems}
Expand All @@ -57,6 +76,8 @@ basePackage = {
buildInputs = buildInputs;
dontStrip=true;

ASDF_OUTPUT_TRANSLATIONS="${builtins.storeDir}/:${builtins.storeDir}";

meta = {
inherit description version;
} // meta;
Expand Down
13 changes: 13 additions & 0 deletions pkgs/development/lisp-modules/quicklisp-to-nix-aliases.nix
@@ -0,0 +1,13 @@
{quicklisp-to-nix-packages}:
with quicklisp-to-nix-packages;
rec {
cffi-grovel = cffi;

cxml-test = null;
cxml-dom = null;
cxml-klacks = null;
cxml-xml = null;

cl-async-util = cl-async-base;
cl-async = cl-async-base;
}

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -16,8 +16,13 @@ rec {
postInstall = ''
find "$out/lib/common-lisp/" -name '*.asd' | grep -iv '/3bmd[.]asd${"$"}' |
while read f; do
CL_SOURCE_REGISTRY= \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(asdf:load-system :$(basename "$f" .asd))'" \
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(progn
(asdf:load-system :$(basename "$f" .asd))
(asdf:perform (quote asdf:compile-bundle-op) :$(basename "$f" .asd))
(ignore-errors (asdf:perform (quote asdf:deliver-asd-op) :$(basename "$f" .asd)))
)'" \
"$out"/bin/*-lisp-launcher.sh ||
mv "$f"{,.sibling}; done || true
'';
Expand Down
Expand Up @@ -16,8 +16,13 @@ rec {
postInstall = ''
find "$out/lib/common-lisp/" -name '*.asd' | grep -iv '/alexandria[.]asd${"$"}' |
while read f; do
CL_SOURCE_REGISTRY= \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(asdf:load-system :$(basename "$f" .asd))'" \
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(progn
(asdf:load-system :$(basename "$f" .asd))
(asdf:perform (quote asdf:compile-bundle-op) :$(basename "$f" .asd))
(ignore-errors (asdf:perform (quote asdf:deliver-asd-op) :$(basename "$f" .asd)))
)'" \
"$out"/bin/*-lisp-launcher.sh ||
mv "$f"{,.sibling}; done || true
'';
Expand Down
Expand Up @@ -16,8 +16,13 @@ rec {
postInstall = ''
find "$out/lib/common-lisp/" -name '*.asd' | grep -iv '/anaphora[.]asd${"$"}' |
while read f; do
CL_SOURCE_REGISTRY= \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(asdf:load-system :$(basename "$f" .asd))'" \
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(progn
(asdf:load-system :$(basename "$f" .asd))
(asdf:perform (quote asdf:compile-bundle-op) :$(basename "$f" .asd))
(ignore-errors (asdf:perform (quote asdf:deliver-asd-op) :$(basename "$f" .asd)))
)'" \
"$out"/bin/*-lisp-launcher.sh ||
mv "$f"{,.sibling}; done || true
'';
Expand Down
Expand Up @@ -16,8 +16,13 @@ rec {
postInstall = ''
find "$out/lib/common-lisp/" -name '*.asd' | grep -iv '/array-utils[.]asd${"$"}' |
while read f; do
CL_SOURCE_REGISTRY= \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(asdf:load-system :$(basename "$f" .asd))'" \
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(progn
(asdf:load-system :$(basename "$f" .asd))
(asdf:perform (quote asdf:compile-bundle-op) :$(basename "$f" .asd))
(ignore-errors (asdf:perform (quote asdf:deliver-asd-op) :$(basename "$f" .asd)))
)'" \
"$out"/bin/*-lisp-launcher.sh ||
mv "$f"{,.sibling}; done || true
'';
Expand Down
Expand Up @@ -16,8 +16,13 @@ rec {
postInstall = ''
find "$out/lib/common-lisp/" -name '*.asd' | grep -iv '/babel-streams[.]asd${"$"}' |
while read f; do
CL_SOURCE_REGISTRY= \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(asdf:load-system :$(basename "$f" .asd))'" \
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(progn
(asdf:load-system :$(basename "$f" .asd))
(asdf:perform (quote asdf:compile-bundle-op) :$(basename "$f" .asd))
(ignore-errors (asdf:perform (quote asdf:deliver-asd-op) :$(basename "$f" .asd)))
)'" \
"$out"/bin/*-lisp-launcher.sh ||
mv "$f"{,.sibling}; done || true
'';
Expand Down
Expand Up @@ -16,8 +16,13 @@ rec {
postInstall = ''
find "$out/lib/common-lisp/" -name '*.asd' | grep -iv '/babel[.]asd${"$"}' |
while read f; do
CL_SOURCE_REGISTRY= \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(asdf:load-system :$(basename "$f" .asd))'" \
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(progn
(asdf:load-system :$(basename "$f" .asd))
(asdf:perform (quote asdf:compile-bundle-op) :$(basename "$f" .asd))
(ignore-errors (asdf:perform (quote asdf:deliver-asd-op) :$(basename "$f" .asd)))
)'" \
"$out"/bin/*-lisp-launcher.sh ||
mv "$f"{,.sibling}; done || true
'';
Expand Down
Expand Up @@ -16,8 +16,13 @@ rec {
postInstall = ''
find "$out/lib/common-lisp/" -name '*.asd' | grep -iv '/blackbird[.]asd${"$"}' |
while read f; do
CL_SOURCE_REGISTRY= \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(asdf:load-system :$(basename "$f" .asd))'" \
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(progn
(asdf:load-system :$(basename "$f" .asd))
(asdf:perform (quote asdf:compile-bundle-op) :$(basename "$f" .asd))
(ignore-errors (asdf:perform (quote asdf:deliver-asd-op) :$(basename "$f" .asd)))
)'" \
"$out"/bin/*-lisp-launcher.sh ||
mv "$f"{,.sibling}; done || true
'';
Expand Down
Expand Up @@ -16,8 +16,13 @@ rec {
postInstall = ''
find "$out/lib/common-lisp/" -name '*.asd' | grep -iv '/bordeaux-threads[.]asd${"$"}' |
while read f; do
CL_SOURCE_REGISTRY= \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(asdf:load-system :$(basename "$f" .asd))'" \
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK="nix_lisp_run_single_form '(progn
(asdf:load-system :$(basename "$f" .asd))
(asdf:perform (quote asdf:compile-bundle-op) :$(basename "$f" .asd))
(ignore-errors (asdf:perform (quote asdf:deliver-asd-op) :$(basename "$f" .asd)))
)'" \
"$out"/bin/*-lisp-launcher.sh ||
mv "$f"{,.sibling}; done || true
'';
Expand Down

0 comments on commit 365e8a7

Please sign in to comment.