setup.sh: make sure initialPath goes at end of HOST_PATH

We want initialPath to have lowest precedence.

In addition, unset _PATH and _HOST_PATH as they shouldn’t be needed
after final PATH and HOST_PATH are set.
This commit is contained in:
Matthew Bauer 2019-03-02 20:02:45 -05:00
parent a1533dfc41
commit ec7d72a57d

@ -182,10 +182,8 @@ addToSearchPathWithCustomDelimiter() {
fi
}
PATH_DELIMITER=':'
addToSearchPath() {
addToSearchPathWithCustomDelimiter "${PATH_DELIMITER}" "$@"
addToSearchPathWithCustomDelimiter ":" "$@"
}
# Add $1/lib* into rpaths.
@ -508,7 +506,7 @@ activatePackage() {
fi
if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then
addToSearchPath HOST_PATH "$pkg/bin"
addToSearchPath _HOST_PATH "$pkg/bin"
fi
if [[ -f "$pkg/nix-support/setup-hook" ]]; then
@ -617,10 +615,15 @@ fi
PATH="${_PATH-}${_PATH:+${PATH:+:}}$PATH"
HOST_PATH="${_HOST_PATH-}${_HOST_PATH:+${HOST_PATH:+:}}$HOST_PATH"
if (( "${NIX_DEBUG:-0}" >= 1 )); then
echo "final path: $PATH"
echo "final host path: $HOST_PATH"
fi
unset _PATH
unset _HOST_PATH
# Make GNU Make produce nested output.
export NIX_INDENT_MAKE=1