about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2020-04-15 08:07:46 -0400
committerProfpatsch <mail@profpatsch.de>2022-06-20 22:20:26 +0200
commitff38ee15c2762ffeacbfe19a259101c685429060 (patch)
tree0f43ee2f1c4e4d71dc73f279fe654fac4ff9eb99 /lib
parent3ac995a5680610000f36c855435062626cde1bed (diff)
maintainer teams: check them in lib tests
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/release.nix4
-rw-r--r--lib/tests/teams.nix50
2 files changed, 54 insertions, 0 deletions
diff --git a/lib/tests/release.nix b/lib/tests/release.nix
index 815841e0a8f30..b93a4236f91e1 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 0000000000000..8a0a5d272634b
--- /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)