Overhaul quicklisp-to-nix

1. Detect (and automatically handle) parasitic systems.
2. Each nix package has only one asd, and (almost) every parasitic
   package inside it builds.
3. Ensure that parasitic systems are compiled.
4. Remove unnecessary testnames lisp override mechanism (the
   testnae/testSystem is replaced by parasites/buildSystems).
5. Parasitic systems (if included in the system closure) become
   aliases to their host package.
6. Support caching fasl files in a known directory (for faster
   re-generation after modifying quicklisp-to-nix-system-info).
7. Eliminate unnecessary overrides.  We're going to determine ALL
   lisp dependencies correctly.
8. Don't try to "build" lisp packages with make.  lispPackages should
   be about bringing in a lisp library.
9. Eliminate the hand-maintained list of aliases.  Parasites should
   become aliases.  Everything else should be a real package.
This commit is contained in:
Brad Jensen
2017-08-31 20:10:18 -07:00
parent 86e6e8016d
commit f0c8027ae3
13 changed files with 1116 additions and 313 deletions
@@ -1,7 +1,10 @@
args @ {stdenv, clwrapper, baseName, packageName ? baseName, testSystems ? [packageName]
args @ {stdenv, clwrapper, baseName, packageName ? baseName
, parasites ? []
, buildSystems ? ([packageName] ++ parasites)
, version ? "latest"
, src, description, deps, buildInputs ? [], meta ? {}, overrides?(x: {})
, propagatedBuildInputs ? []}:
, propagatedBuildInputs ? []
, asdFilesToKeep ? [(builtins.concatStringsSep "" [packageName ".asd"])]}:
let
deployConfigScript = ''
outhash="$out"
@@ -43,11 +46,34 @@ let
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"
'';
moveAsdFiles = ''
find $out/lib/common-lisp/ -name '*.asd' | while read ASD_FILE; do
KEEP_THIS_ASD=0
for ALLOWED_ASD in $asdFilesToKeep; do
ALLOWED_ASD="/$ALLOWED_ASD"
ALLOWED_ASD_LENGTH=${"$"}{#ALLOWED_ASD}
ASD_FILE_LENGTH=${"$"}{#ASD_FILE}
ASD_FILE_SUFFIX_INDEX=$(expr "$ASD_FILE_LENGTH" - "$ALLOWED_ASD_LENGTH")
ASD_FILE_SUFFIX_INDEX=$(expr "$ASD_FILE_SUFFIX_INDEX" + 1)
echo $ALLOWED_ASD $ASD_FILE $ASD_FILE_SUFFIX_INDEX $(expr substr "$ASD_FILE" "$ASD_FILE_SUFFIX_INDEX" "$ASD_FILE_LENGTH")
if [ "$(expr substr "$ASD_FILE" "$ASD_FILE_SUFFIX_INDEX" "$ASD_FILE_LENGTH")" == "$ALLOWED_ASD" ]; then
KEEP_THIS_ASD=1
break
fi
done
if [ "$KEEP_THIS_ASD" == 0 ]; then
mv "$ASD_FILE"{,.sibling}
fi
done
'';
basePackage = {
name = "lisp-${baseName}-${version}";
inherit src;
dontBuild = true;
inherit deployConfigScript deployLaunchScript;
inherit asdFilesToKeep moveAsdFiles;
installPhase = ''
eval "$preInstall"
@@ -58,18 +84,19 @@ basePackage = {
${deployConfigScript}
${deployLaunchScript}
${moveAsdFiles}
${stdenv.lib.concatMapStrings (testSystem: ''
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: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}
env -i \
NIX_LISP="$NIX_LISP" \
NIX_LISP_PRELAUNCH_HOOK='nix_lisp_run_single_form "(progn
${stdenv.lib.concatMapStrings (system: ''
(asdf:compile-system :${system})
(asdf:load-system :${system})
(asdf:operate (quote asdf::compile-bundle-op) :${system})
(ignore-errors (asdf:operate (quote asdf::deploy-asd-op) :${system}))
'') buildSystems}
)"' \
"$out/bin/${args.baseName}-lisp-launcher.sh"
eval "$postInstall"
'';