about summary refs log tree commit diff
path: root/lib/tests/teams.nix
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/tests/teams.nix
parent3ac995a5680610000f36c855435062626cde1bed (diff)
downloadnixlib-ff38ee15c2762ffeacbfe19a259101c685429060.tar
nixlib-ff38ee15c2762ffeacbfe19a259101c685429060.tar.gz
nixlib-ff38ee15c2762ffeacbfe19a259101c685429060.tar.bz2
nixlib-ff38ee15c2762ffeacbfe19a259101c685429060.tar.lz
nixlib-ff38ee15c2762ffeacbfe19a259101c685429060.tar.xz
nixlib-ff38ee15c2762ffeacbfe19a259101c685429060.tar.zst
nixlib-ff38ee15c2762ffeacbfe19a259101c685429060.zip
maintainer teams: check them in lib tests
Diffstat (limited to 'lib/tests/teams.nix')
-rw-r--r--lib/tests/teams.nix50
1 files changed, 50 insertions, 0 deletions
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)