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

environment: Rework test to assert against full $PATH

It’s deterministic after all, so test against the full thing for greater
flexibility in testing and confidence in lack of unexpected changes to
previously-untested parts of the default $PATH.

Do this in a subshell to avoid polluting the test script’s environment.
This commit is contained in:
Andrew Marshall 2024-05-22 13:34:01 -04:00
parent eac4f25028
commit 9b6f77200f

View file

@ -4,10 +4,18 @@ with lib;
{ {
test = '' test = ''
echo checking /run/current-system/sw/bin in environment >&2 echo 'checking PATH' >&2
grep 'export PATH=.*:/run/current-system/sw/bin' ${config.system.build.setEnvironment} env_path=$(bash -c 'source ${config.system.build.setEnvironment}; echo $PATH')
echo checking /bin and /sbin in environment >&2 test "$env_path" = "${builtins.concatStringsSep ":" [
grep 'export PATH=.*:/usr/bin:/usr/sbin:/bin:/sbin' ${config.system.build.setEnvironment} "/homeless-shelter/.nix-profile/bin"
"/run/current-system/sw/bin"
"/nix/var/nix/profiles/default/bin"
"/usr/local/bin"
"/usr/bin"
"/usr/sbin"
"/bin"
"/sbin"
]}"
''; '';
} }