Skip to content

Commit

Permalink
build-support: add addBinToPathHook hook
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jan 11, 2025
1 parent 0a85603 commit 3522886
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkgs/build-support/setup-hooks/add-bin-to-path.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# shellcheck shell=bash
# This setup hook add $out/bin to the PATH environment variable.

export PATH

addBinToPath () {
# shellcheck disable=SC2154
if [ -d "$out/bin" ]; then
PATH="$out/bin:$PATH"
export PATH
fi
}

# shellcheck disable=SC2154
addEnvHooks "$targetOffset" addBinToPath
7 changes: 7 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ with pkgs;

__flattenIncludeHackHook = callPackage ../build-support/setup-hooks/flatten-include-hack { };

addBinToPathHook = callPackage (
{ makeSetupHook }:
makeSetupHook {
name = "add-bin-to-path-hook";
} ../build-support/setup-hooks/add-bin-to-path.sh
) { };

autoreconfHook = callPackage (
{ makeSetupHook, autoconf, automake, gettext, libtool }:
makeSetupHook {
Expand Down

0 comments on commit 3522886

Please sign in to comment.