home-environment: prepend to PATH in sessionPath

This makes the options behave as people expect it to: one's personal
configuration can shadow system executables.

Closes #3324.
This commit is contained in:
Bruno BELANYI 2023-11-20 15:46:45 +00:00
parent 993fb02d20
commit e5471d3145
2 changed files with 2 additions and 2 deletions

View file

@ -556,7 +556,7 @@ in
${config.lib.shell.exportAll cfg.sessionVariables}
'' + lib.optionalString (cfg.sessionPath != [ ]) ''
export PATH="$PATH''${PATH:+:}${concatStringsSep ":" cfg.sessionPath}"
export PATH="${concatStringsSep ":" cfg.sessionPath}''${PATH:+:}$PATH"
'' + cfg.sessionVariablesExtra;
};

View file

@ -10,6 +10,6 @@
hmSessVars=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmSessVars
assertFileContains $hmSessVars \
'export PATH="$PATH''${PATH:+:}bar:baz:foo"'
'export PATH="bar:baz:foo''${PATH:+:}$PATH"'
'';
}