diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 870464608..87f860f02 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -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; }; diff --git a/tests/modules/home-environment/session-path.nix b/tests/modules/home-environment/session-path.nix index 57cfeceda..55c4084a7 100644 --- a/tests/modules/home-environment/session-path.nix +++ b/tests/modules/home-environment/session-path.nix @@ -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"' ''; }