summaryrefslogtreecommitdiffstats
path: root/modules/generic/meta-maintainers/test.nix
blob: aff61454f4c6db2142f2b8b0dbff1ed7a03e177d (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
40
41
42
43
44
45
46
47
48
49
# Run:
#   $ nix-instantiate --eval 'modules/generic/meta-maintainers/test.nix'
#
# Expected output:
#   { }
#
# Debugging:
#   drop .test from the end of this file, then use nix repl on it
let
  ghost = {
    github = "ghost";
    githubId = 0;
    name = "ghost";
  };
in
rec {
  # Inject ghost into lib.maintainers so it passes the addCheck validation
  lib = (import ../../../lib).extend (
    final: prev: {
      maintainers = prev.maintainers // {
        inherit ghost;
      };
    }
  );

  example = lib.evalModules {
    specialArgs.lib = lib;
    modules = [
      ../meta-maintainers.nix
      {
        _file = "ghost.nix";
        meta.maintainers = [ ghost ];
      }
    ];
  };

  test =
    assert
      example.config.meta.maintainers == {
        ${toString ../../../lib/modules/generic/meta-maintainers.nix} = [
          lib.maintainers.pierron
          lib.maintainers.roberth
        ];
        "ghost.nix" = [ ghost ];
      };
    { };

}
.test