From cd91d1ad9f108182b78ebfd6f72f0924fe843c09 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Sun, 22 Jul 2018 23:07:25 -0400 Subject: [PATCH] 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. --- pkgs/stdenv/generic/setup.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index c5feffcea99b..8b98aac1146d 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -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