summaryrefslogtreecommitdiff
path: root/tests/environment-path.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tests/environment-path.nix')
-rw-r--r--tests/environment-path.nix34
1 files changed, 30 insertions, 4 deletions
diff --git a/tests/environment-path.nix b/tests/environment-path.nix
index 7d2f46d..0bb9a05 100644
--- a/tests/environment-path.nix
+++ b/tests/environment-path.nix
@@ -3,11 +3,37 @@
with lib;
{
+ environment.systemPath = mkMerge [
+ (mkBefore [ "beforePath" ])
+ [ "myPath" ]
+ (mkAfter [ "afterPath" ])
+ ];
+
+ environment.profiles = mkMerge [
+ (mkBefore [ "beforeProfile" ])
+ [ "myProfile" ]
+ (mkAfter [ "afterProfile" ])
+ ];
+
test = ''
- echo checking /run/current-system/sw/bin in environment >&2
- grep 'export PATH=.*:/run/current-system/sw/bin' ${config.system.build.setEnvironment}
+ echo 'checking PATH' >&2
+ env_path=$(bash -c 'source ${config.system.build.setEnvironment}; echo $PATH')
- echo checking /bin and /sbin in environment >&2
- grep 'export PATH=.*:/usr/bin:/usr/sbin:/bin:/sbin' ${config.system.build.setEnvironment}
+ 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"
+ ]}"
'';
}