summaryrefslogtreecommitdiff
path: root/tests/environment-path.nix
blob: 0bb9a055807b973efec2f4f4d814fc5c1db597c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ config, lib, pkgs, ... }:

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"
    ]}"
  '';
}