From e5471d3145d1924a65f0ae9933d69aa512d9b38b Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 20 Nov 2023 15:46:45 +0000 Subject: [PATCH] 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. --- modules/home-environment.nix | 2 +- tests/modules/home-environment/session-path.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 87046460..87f860f0 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 57cfeced..55c4084a 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"' ''; }