From ff38ee15c2762ffeacbfe19a259101c685429060 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 15 Apr 2020 08:07:46 -0400 Subject: [PATCH] maintainer teams: check them in lib tests --- lib/tests/release.nix | 4 ++++ lib/tests/teams.nix | 50 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 lib/tests/teams.nix diff --git a/lib/tests/release.nix b/lib/tests/release.nix index 815841e0a8f3..b93a4236f91e 100644 --- a/lib/tests/release.nix +++ b/lib/tests/release.nix @@ -11,6 +11,10 @@ pkgs.runCommand "nixpkgs-lib-tests" { inherit pkgs; lib = import ../.; }) + (import ./teams.nix { + inherit pkgs; + lib = import ../.; + }) ]; } '' datadir="${pkgs.nix}/share" diff --git a/lib/tests/teams.nix b/lib/tests/teams.nix new file mode 100644 index 000000000000..8a0a5d272634 --- /dev/null +++ b/lib/tests/teams.nix @@ -0,0 +1,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)