diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix index a8a07f6d071e..8a5fc288f1ec 100644 --- a/pkgs/build-support/trivial-builders/default.nix +++ b/pkgs/build-support/trivial-builders/default.nix @@ -269,6 +269,7 @@ rec { { name , text , runtimeInputs ? [ ] + , runtimeEnv ? null , meta ? { } , checkPhase ? null , excludeShellChecks ? [ ] @@ -283,7 +284,15 @@ rec { text = '' #!${runtimeShell} ${lib.concatMapStringsSep "\n" (option: "set -o ${option}") bashOptions} - '' + lib.optionalString (runtimeInputs != [ ]) '' + '' + lib.optionalString (runtimeEnv != null) + (lib.concatStrings + (lib.mapAttrsToList + (name: value: '' + ${lib.toShellVar name value} + export ${name} + '') + runtimeEnv)) + + lib.optionalString (runtimeInputs != [ ]) '' export PATH="${lib.makeBinPath runtimeInputs}:$PATH" '' + ''