about summary refs log tree commit diff
path: root/pkgs/stdenv/generic
diff options
context:
space:
mode:
authorMatthew Bauer <matthew.bauer@obsidian.systems>2018-07-22 23:07:25 -0400
committerMatthew Bauer <matthew.bauer@obsidian.systems>2018-07-22 23:14:49 -0400
commitcd91d1ad9f108182b78ebfd6f72f0924fe843c09 (patch)
tree68467b4328576bd83ce081740a8e53c2dd837d9a /pkgs/stdenv/generic
parent5d3f5bb61e792ae96c45ac5d2efb5f779ffe0401 (diff)
downloadnixlib-cd91d1ad9f108182b78ebfd6f72f0924fe843c09.tar
nixlib-cd91d1ad9f108182b78ebfd6f72f0924fe843c09.tar.gz
nixlib-cd91d1ad9f108182b78ebfd6f72f0924fe843c09.tar.bz2
nixlib-cd91d1ad9f108182b78ebfd6f72f0924fe843c09.tar.lz
nixlib-cd91d1ad9f108182b78ebfd6f72f0924fe843c09.tar.xz
nixlib-cd91d1ad9f108182b78ebfd6f72f0924fe843c09.tar.zst
nixlib-cd91d1ad9f108182b78ebfd6f72f0924fe843c09.zip
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.
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r--pkgs/stdenv/generic/setup.sh4
1 files changed, 4 insertions, 0 deletions
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