summary refs log tree commit diff
path: root/lib/tests/teams.nix
blob: 8a0a5d272634bc834d539764747f3fb4d0277b94 (plain) (blame)
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
# 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
          (import ./maintainer-module.nix { inherit lib; })
        );
        default = [];
      };
      githubTeams = lib.mkOption {
        type = types.listOf types.str;
        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)