summaryrefslogtreecommitdiffstats
path: root/lib/tests/teams.nix
blob: ed7db2b873f106189a0a8c13f8d799a62ee1307e (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# to run these tests:
# nix-build nixpkgs/lib/tests/teams.nix
# If it builds, all tests passed
{
  pkgs ? import ../.. { },
  lib ? pkgs.lib,
}:

let
  inherit (lib) types;

  teamModule =
    { config, ... }:
    {
      options = {
        shortName = lib.mkOption {
          type = types.str;
        };
        scope = lib.mkOption {
          type = types.str;
        };
        enableFeatureFreezePing = lib.mkOption {
          type = types.bool;
          default = false;
        };
        members = lib.mkOption {
          type = types.listOf (types.submodule ./maintainer-module.nix);
          default = [ ];
        };
        github = lib.mkOption {
          type = types.str;
          default = "";
        };
        githubId = lib.mkOption {
          type = types.int;
          default = 0;
        };
        githubMaintainers = lib.mkOption {
          type = types.listOf (types.submodule ./maintainer-module.nix);
          default = [ ];
        };
      };
    };

  checkTeam =
    team: uncheckedAttrs:
    let
      prefix = [
        "lib"
        "maintainer-team"
        team
      ];
      checkedAttrs =
        (lib.modules.evalModules {
          inherit prefix;
          modules = [
            teamModule
            {
              _file = toString ../../maintainers/team-list.nix;
              config = uncheckedAttrs;
            }
          ];
        }).config;
    in
    checkedAttrs;

  checkedTeams = lib.mapAttrs checkTeam lib.teams;
in
pkgs.writeTextDir "maintainer-teams.json" (builtins.toJSON checkedTeams)