core/lib/tests/teams.nix

58 lines
1.3 KiB
Nix
Raw Normal View History

2024-05-01 22:14:04 +00:00
# to run these tests:
# nix-build nixpkgs/lib/tests/teams.nix
# If it builds, all tests passed
2024-06-30 08:16:52 +00:00
{
pkgs ? import ../.. { },
lib ? pkgs.lib,
}:
2024-05-01 22:14:04 +00:00
let
inherit (lib) types;
2024-06-30 08:16:52 +00:00
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 = [ ];
};
2024-05-01 22:14:04 +00:00
};
};
2024-06-30 08:16:52 +00:00
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;
2024-05-01 22:14:04 +00:00
checkedTeams = lib.mapAttrs checkTeam lib.teams;
2024-06-30 08:16:52 +00:00
in
pkgs.writeTextDir "maintainer-teams.json" (builtins.toJSON checkedTeams)