1# to run these tests:
2# nix-build nixpkgs/lib/tests/teams.nix
3# If it builds, all tests passed
4{ pkgs ? import ../.. {}, lib ? pkgs.lib }:
5
6let
7 inherit (lib) types;
8
9 teamModule = { config, ... }: {
10 options = {
11 shortName = lib.mkOption {
12 type = types.str;
13 };
14 scope = lib.mkOption {
15 type = types.str;
16 };
17 enableFeatureFreezePing = lib.mkOption {
18 type = types.bool;
19 default = false;
20 };
21 members = lib.mkOption {
22 type = types.listOf (types.submodule
23 (import ./maintainer-module.nix { inherit lib; })
24 );
25 default = [];
26 };
27 githubTeams = lib.mkOption {
28 type = types.listOf types.str;
29 default = [];
30 };
31 };
32 };
33
34 checkTeam = team: uncheckedAttrs:
35 let
36 prefix = [ "lib" "maintainer-team" team ];
37 checkedAttrs = (lib.modules.evalModules {
38 inherit prefix;
39 modules = [
40 teamModule
41 {
42 _file = toString ../../maintainers/team-list.nix;
43 config = uncheckedAttrs;
44 }
45 ];
46 }).config;
47 in checkedAttrs;
48
49 checkedTeams = lib.mapAttrs checkTeam lib.teams;
50in pkgs.writeTextDir "maintainer-teams.json" (builtins.toJSON checkedTeams)