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