1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

Merge pull request #956 from amarshall/systempath-order

environment: Adjust systemPath order to allow injecting in the middle
This commit is contained in:
Michael Hoang 2024-05-24 10:37:35 +10:00 committed by GitHub
commit 0bea8222f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 6 deletions

View file

@ -151,7 +151,10 @@ in
config = {
environment.systemPath = [ (makeBinPath cfg.profiles) "/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" ];
environment.systemPath = mkMerge [
[ (makeBinPath cfg.profiles) ]
(mkOrder 1200 [ "/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin" ])
];
# Use user, default and system profiles.
environment.profiles = mkMerge [

View file

@ -3,11 +3,37 @@
with lib;
{
test = ''
echo checking /run/current-system/sw/bin in environment >&2
grep 'export PATH=.*:/run/current-system/sw/bin' ${config.system.build.setEnvironment}
environment.systemPath = mkMerge [
(mkBefore [ "beforePath" ])
[ "myPath" ]
(mkAfter [ "afterPath" ])
];
echo checking /bin and /sbin in environment >&2
grep 'export PATH=.*:/usr/bin:/usr/sbin:/bin:/sbin' ${config.system.build.setEnvironment}
environment.profiles = mkMerge [
(mkBefore [ "beforeProfile" ])
[ "myProfile" ]
(mkAfter [ "afterProfile" ])
];
test = ''
echo 'checking PATH' >&2
env_path=$(bash -c 'source ${config.system.build.setEnvironment}; echo $PATH')
test "$env_path" = "${builtins.concatStringsSep ":" [
"beforePath"
"myPath"
"beforeProfile/bin"
"/homeless-shelter/.nix-profile/bin"
"myProfile/bin"
"/run/current-system/sw/bin"
"/nix/var/nix/profiles/default/bin"
"afterProfile/bin"
"/usr/local/bin"
"/usr/bin"
"/usr/sbin"
"/bin"
"/sbin"
"afterPath"
]}"
'';
}