modules: add env option

This commit is contained in:
Gaetan Lepage 2025-03-23 12:27:50 +01:00 committed by Gaétan Lepage
parent f4f4b4975a
commit db01a0dd97
3 changed files with 72 additions and 1 deletions

View file

@ -339,7 +339,16 @@ in
initSource;
extraWrapperArgs = builtins.concatStringsSep " " (
(optional (
# Setting environment variables in the wrapper
(lib.mapAttrsToList (
name: value:
lib.escapeShellArgs [
"--set"
name
value
]
) config.env)
++ (optional (
config.extraPackages != [ ]
) ''--prefix PATH : "${lib.makeBinPath config.extraPackages}"'')
++ (optional config.wrapRc ''--add-flags -u --add-flags "${initFile}"'')