From bd0ed8599fd4871e79543e09075dac2c2c25ff2a Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 22 May 2024 13:43:33 -0400 Subject: [PATCH] environment: Test how order of systemPath and profiles manifests --- tests/environment-path.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/environment-path.nix b/tests/environment-path.nix index 5ddaf9c9..0bb9a055 100644 --- a/tests/environment-path.nix +++ b/tests/environment-path.nix @@ -3,19 +3,37 @@ with lib; { + environment.systemPath = mkMerge [ + (mkBefore [ "beforePath" ]) + [ "myPath" ] + (mkAfter [ "afterPath" ]) + ]; + + 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" ]}" ''; }