diff --git a/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh b/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh index 55b469729f9..fa914f6d26b 100755 --- a/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh +++ b/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh @@ -87,6 +87,33 @@ nix_lisp_run_single_form(){ "$NIX_LISP_EXEC_CODE" "$NIX_LISP_QUIT" $NIX_LISP_NODEBUG) } +nix_lisp_build_system(){ + NIX_LISP_FINAL_PARAMETERS=( + "$NIX_LISP_EXEC_CODE" "(progn + (asdf:make :$1) + (loop for s in (list $(for i in $3; do echo ":$i"; done)) do (asdf:make s)))" + "$NIX_LISP_EXEC_CODE" "(progn + (setf (asdf/system:component-entry-point (asdf:find-system :$1)) ${2:-nil}) + #+cffi(setf cffi:*foreign-library-directories* + (cffi::explode-path-environment-variable \"NIX_LISP_LD_LIBRARY_PATH\")) + #+sbcl(loop + with libpath := (uiop:split-string (uiop:getenv \"NIX_LISP_LD_LIBRARY_PATH\") + :separator \":\") + for l in sb-alien::*shared-objects* + for ns := (sb-alien::shared-object-namestring l) + do (and (> (length ns) 0) (not (equal (elt ns 0) "/")) + (let* + ((prefix (find-if (lambda (s) (probe-file (format nil \"~a/~a\" s ns))) libpath)) + (fullpath (and prefix (format nil \"~a/~a\" prefix ns)))) + (when fullpath + (setf + (sb-alien::shared-object-namestring l) fullpath + (sb-alien::shared-object-pathname l) (probe-file fullpath))))) + ) + (asdf:perform (quote asdf:program-op) :$1) + )") +} + eval "$NIX_LISP_PRELAUNCH_HOOK" [ -z "$NIX_LISP_SKIP_CODE" ] && "$NIX_LISP_COMMAND" $NIX_LISP_EARLY_OPTIONS \ diff --git a/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix b/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix index 09113bc30bb..4de4947c073 100644 --- a/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix +++ b/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix @@ -15,9 +15,8 @@ in export configureFlags="$configureFlags --with-$NIX_LISP=common-lisp.sh"; ''; postInstall = '' - "$out/bin/stumpwm-lisp-launcher.sh" --eval '(asdf:make :stumpwm)' \ - --eval '(setf (asdf/system:component-entry-point (asdf:find-system :stumpwm)) (function stumpwm:stumpwm))' \ - --eval '(asdf:perform (quote asdf:program-op) :stumpwm)' + export NIX_LISP_PRELAUNCH_HOOK="nix_lisp_build_system stumpwm '(function stumpwm:stumpwm)'" + "$out/bin/stumpwm-lisp-launcher.sh" cp "$out/lib/common-lisp/stumpwm/stumpwm" "$out/bin" ''; @@ -69,12 +68,10 @@ in export NIX_LISP_ASDF_PATHS="$NIX_LISP_ASDF_PATHS $out/lib/common-lisp/query-fs" export HOME=$PWD - "$out/bin/query-fs-lisp-launcher.sh" --eval '(asdf:make :query-fs)' \ - --eval "(progn $(for i in $linkedSystems; do echo "(asdf:make :$i)"; done) )" \ - --eval '(setf (asdf/system:component-entry-point (asdf:find-system :query-fs)) - (function query-fs:run-fs-with-cmdline-args))' \ - --eval '(asdf:perform (quote asdf:program-op) :query-fs)' - cp "$out/lib/common-lisp/query-fs/query-fs" "$out/bin/" + export NIX_LISP_PRELAUNCH_HOOK="nix_lisp_build_system query-fs \ + '(function query-fs:run-fs-with-cmdline-args)' '$linkedSystems'" + "$out/bin/query-fs-lisp-launcher.sh" + cp "$out/lib/common-lisp/query-fs/query-fs" "$out/bin/" ''; }; };