diff --git a/pkgs/development/lisp-modules/clwrapper/default.nix b/pkgs/development/lisp-modules/clwrapper/default.nix index 019a44482b9a..3cb8219e6874 100644 --- a/pkgs/development/lisp-modules/clwrapper/default.nix +++ b/pkgs/development/lisp-modules/clwrapper/default.nix @@ -15,6 +15,7 @@ stdenv.mkDerivation { chmod a+x "$out"/bin/* substituteAll "${./setup-hook.sh}" "setup-hook-parsed" + addEnvHooks(){ true; }; source setup-hook-parsed setLisp "${lisp}" echo "$NIX_LISP" diff --git a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh index da2303a18bfb..abbbdc3e77a6 100644 --- a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh +++ b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh @@ -9,7 +9,7 @@ addASDFPaths () { } setLisp () { - if [ -z "$NIX_LISP_COMMAND" ]; then + if [ -z "${NIX_LISP_COMMAND:-}" ]; then for j in "$1"/bin/*; do case "$(basename "$j")" in sbcl) NIX_LISP_COMMAND="$j" ;; @@ -20,7 +20,7 @@ setLisp () { esac done fi - if [ -z "$NIX_LISP" ]; then + if [ -n "${NIX_LISP_COMMAND:-}" ] && [ -z "${NIX_LISP:-}" ]; then NIX_LISP="${NIX_LISP_COMMAND##*/}" fi } @@ -35,5 +35,5 @@ export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF addEnvHooks "$targetOffset" addASDFPaths setLisp collectNixLispLDLP -mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home" +mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-${USER:-nixbld}-home" mkdir -p "$HOME"/.cache/common-lisp diff --git a/pkgs/development/lisp-modules/define-package.nix b/pkgs/development/lisp-modules/define-package.nix index 49eb9c403447..67a688342b2d 100644 --- a/pkgs/development/lisp-modules/define-package.nix +++ b/pkgs/development/lisp-modules/define-package.nix @@ -18,7 +18,7 @@ let 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 "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" @@ -28,12 +28,12 @@ let 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 "export NIX_LISP_ASDF_PATHS=\"$( ( echo "\$NIX_LISP_ASDF_PATHS"; echo "$NIX_LISP_ASDF_PATHS"; echo "$out/lib/common-lisp/${args.baseName}" ) | grep . | sort | uniq)\"" >> "$path_config_script" + echo "if test -z \"\''${_''${outhash}_NIX_LISP_PATH_CONFIG:-}\"; then export _''${outhash}_NIX_LISP_PATH_CONFIG=1; " >> "$path_config_script" + echo "export NIX_LISP_ASDF_PATHS=\"$( ( echo "\''${NIX_LISP_ASDF_PATHS:-}"; echo "$NIX_LISP_ASDF_PATHS"; echo "$out/lib/common-lisp/${args.baseName}" ) | grep . | sort | uniq)\"" >> "$path_config_script" test -n "$LD_LIBRARY_PATH" && 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:+:}\"'$(echo "$NIX_LISP_LD_LIBRARY_PATH" | tr -d '\n' | tr : '\n' | sort | uniq | tr '\n' ':' | sed -e 's/:$//')'" >> "$path_config_script" + echo "export NIX_LISP_LD_LIBRARY_PATH=\"\''${NIX_LISP_LD_LIBRARY_PATH:-}\''${NIX_LISP_LD_LIBRARY_PATH:+:}\"'$(echo "$NIX_LISP_LD_LIBRARY_PATH" | tr -d '\n' | tr : '\n' | sort | uniq | tr '\n' ':' | sed -e 's/:$//')'" >> "$path_config_script" echo "fi" >> "$path_config_script" ''; deployLaunchScript = ''