setup.sh: add HOST_PATH

HOST_PATH contains the path of the host package. This will include the
packages listed in buildInputs & depsHostHost. Use this to find
runtime commands that the host needs.

For instance to find the runtime version of perl,

$ PATH="$HOST_PATH" command -v perl
/nix/store/...-perl-5.28.0-aarch64-unknown-linux-android/bin/perl

This path should not be executed directly (it will break for cross
compilation). Only use it to find the location of executables that
will be run by your host system. Your build tools will, as always, be
available on the default PATH.
This commit is contained in:
Matthew Bauer 2018-07-22 23:07:25 -04:00
parent 5d3f5bb61e
commit cd91d1ad9f

View File

@ -504,6 +504,10 @@ activatePackage() {
addToSearchPath _PATH "$pkg/bin"
fi
if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then
addToSearchPath HOST_PATH "$pkg/bin"
fi
if [[ -f "$pkg/nix-support/setup-hook" ]]; then
local oldOpts="$(shopt -po nounset)"
set +u