diff --git a/nix/scripts/build.sh b/nix/scripts/build.sh index 3e69861216..a3fe8d7bab 100755 --- a/nix/scripts/build.sh +++ b/nix/scripts/build.sh @@ -55,7 +55,7 @@ nixOpts=( ) # Save derivation from being garbage collected -${GIT_ROOT}/nix/scripts/gcroots.sh "${TARGET}" +${GIT_ROOT}/nix/scripts/gcroots.sh "${TARGET}" "${@}" # Run the actual build echo "Running: nix-build "${nixOpts[@]}" "${@}" default.nix" diff --git a/nix/scripts/gcroots.sh b/nix/scripts/gcroots.sh index 4f3bf5d63f..7470423cb2 100755 --- a/nix/scripts/gcroots.sh +++ b/nix/scripts/gcroots.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -Eeu +set -Ee _NIX_GCROOTS="${_NIX_GCROOTS:-/nix/var/nix/gcroots/per-user/${USER}/status-react}" @@ -9,6 +9,7 @@ source "${GIT_ROOT}/nix/scripts/source.sh" source "${GIT_ROOT}/scripts/colors.sh" TARGET="${1}" +shift if [[ -z "${TARGET}" ]]; then echo -e "${RED}No target specified for gcroots.sh!${RST}" >&2 exit 1 @@ -18,4 +19,4 @@ fi # This prevents it from being removed by 'gc-collect-garbage'. nix-instantiate --attr "${TARGET}" \ --add-root "${_NIX_GCROOTS}/${TARGET}" \ - "${GIT_ROOT}/default.nix" >/dev/null + "${@}" "${GIT_ROOT}/default.nix" >/dev/null