diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix index be67b7b177ac..d2c200d19cec 100644 --- a/pkgs/build-support/trivial-builders/default.nix +++ b/pkgs/build-support/trivial-builders/default.nix @@ -269,6 +269,12 @@ rec { Type: AttrSet */ derivationArgs ? { }, + /* + Whether to inherit the current `$PATH` in the script. + + Type: Bool + */ + inheritPath ? true }: writeTextFile { inherit name meta passthru derivationArgs; @@ -289,7 +295,7 @@ rec { runtimeEnv)) + lib.optionalString (runtimeInputs != [ ]) '' - export PATH="${lib.makeBinPath runtimeInputs}:$PATH" + export PATH="${lib.makeBinPath runtimeInputs}${lib.optionalString inheritPath ":$PATH"}" '' + '' ${text}