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:
commit
0bea8222f6
2 changed files with 35 additions and 6 deletions
|
@ -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 [
|
||||
|
|
|
@ -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"
|
||||
]}"
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue