aboutsummaryrefslogtreecommitdiff
path: root/tests/teams.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-08-16 15:46:37 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-08-16 15:46:37 +0200
commit63e0b5d081fed582ac6a0a66f402dc525953524b (patch)
tree1bdcd7fc8a6a40b2e805bad759b36e64e911036b /tests/teams.nix
GC root for fetched nixpkgs/lib content
Diffstat (limited to 'tests/teams.nix')
-rw-r--r--tests/teams.nix50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/teams.nix b/tests/teams.nix
new file mode 100644
index 000000000..8a0a5d272
--- /dev/null
+++ b/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)