1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00

writeShellApplication: Add runtimeEnv argument

This commit is contained in:
Rebecca Turner 2024-01-12 13:30:36 -08:00
parent ac20bcf449
commit a64766913f
No known key found for this signature in database

View file

@ -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"
'' + ''