wrapper-manager-fds/modules: update PATH and XDG dirs to be a part of env instead

This makes it easier to work with for custom modules.
This commit is contained in:
Gabriel Arazas 2024-07-27 12:09:47 +08:00
parent 9639a16a65
commit aef2ac2825
2 changed files with 7 additions and 5 deletions

View File

@ -118,12 +118,13 @@ let
}; };
config = { config = {
env.PATH = lib.concatStringsSep ":" config.pathAdd;
makeWrapperArgs = [ makeWrapperArgs = [
"--argv0" config.arg0 "--argv0" config.arg0
] ]
++ (lib.mapAttrsToList (n: v: "--set ${n} ${v}") config.env)
++ (builtins.map (v: "--unset ${v}") config.unset) ++ (builtins.map (v: "--unset ${v}") config.unset)
++ (builtins.map (v: "--prefix 'PATH' ':' ${v}") config.pathAdd) ++ (lib.mapAttrsToList (n: v: "--set ${n} ${v}") config.env)
++ (builtins.map (v: "--add-flags ${v}") config.prependArgs) ++ (builtins.map (v: "--add-flags ${v}") config.prependArgs)
++ (builtins.map (v: "--append-flags ${v}") config.appendArgs) ++ (builtins.map (v: "--append-flags ${v}") config.appendArgs)
++ (lib.optionals (!envConfig.build.isBinary && config.preScript != "") ( ++ (lib.optionals (!envConfig.build.isBinary && config.preScript != "") (

View File

@ -48,9 +48,10 @@ in
config.xdg.configDirs = cfg.configDirs; config.xdg.configDirs = cfg.configDirs;
config.xdg.dataDirs = cfg.dataDirs; config.xdg.dataDirs = cfg.dataDirs;
config.makeWrapperArgs = config.env = {
builtins.map (v: "--prefix 'XDG_CONFIG_DIRS' ':' ${v}") config.xdg.configDirs XDG_CONFIG_DIRS = lib.concatStringsSep ":" config.xdg.configDirs;
++ (builtins.map (v: "--prefix 'XDG_DATA_DIRS' ':' ${v}") config.xdg.dataDirs); XDG_DATA_DIRS = lib.concatStringsSep ":" config.xdg.dataDirs;
};
}; };
in in
with lib.types; attrsOf (submodule xdgDirsType); with lib.types; attrsOf (submodule xdgDirsType);