about summary refs log tree commit diff
path: root/lib/tests
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2023-01-05 14:34:07 +0100
committerNaïm Favier <n@monade.li>2023-01-27 18:04:20 +0100
commit4e39849611af4d5d53bd35fac73ee56b52010fd2 (patch)
treead03f67a766cf4827889636a7362bcef67fd3710 /lib/tests
parent6173948c03942a3eaff2e18c7375f4f79c3b1739 (diff)
maintainers: make `email` optional
Not giving an email address is fine as long as the maintainer is
reachable through other means, such as GitHub or Matrix.
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/maintainer-module.nix3
-rw-r--r--lib/tests/maintainers.nix6
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/tests/maintainer-module.nix b/lib/tests/maintainer-module.nix
index 8cf8411b476a4..afa12587a98d7 100644
--- a/lib/tests/maintainer-module.nix
+++ b/lib/tests/maintainer-module.nix
@@ -7,7 +7,8 @@ in {
       type = types.str;
     };
     email = lib.mkOption {
-      type = types.str;
+      type = types.nullOr types.str;
+      default = null;
     };
     matrix = lib.mkOption {
       type = types.nullOr types.str;
diff --git a/lib/tests/maintainers.nix b/lib/tests/maintainers.nix
index 8a9a2b26efaf7..f82b63649b1f6 100644
--- a/lib/tests/maintainers.nix
+++ b/lib/tests/maintainers.nix
@@ -20,7 +20,7 @@ let
         ];
       }).config;
 
-      checkGithubId = lib.optional (checkedAttrs.github != null && checkedAttrs.githubId == null) ''
+      checks = lib.optional (checkedAttrs.github != null && checkedAttrs.githubId == null) ''
         echo ${lib.escapeShellArg (lib.showOption prefix)}': If `github` is specified, `githubId` must be too.'
         # Calling this too often would hit non-authenticated API limits, but this
         # shouldn't happen since such errors will get fixed rather quickly
@@ -28,8 +28,10 @@ let
         id=$(jq -r '.id' <<< "$info")
         echo "The GitHub ID for GitHub user ${checkedAttrs.github} is $id:"
         echo -e "    githubId = $id;\n"
+      '' ++ lib.optional (checkedAttrs.email == null && checkedAttrs.github == null && checkedAttrs.matrix == null) ''
+        echo ${lib.escapeShellArg (lib.showOption prefix)}': At least one of `email`, `github` or `matrix` must be specified, so that users know how to reach you.'
       '';
-    in lib.deepSeq checkedAttrs checkGithubId;
+    in lib.deepSeq checkedAttrs checks;
 
   missingGithubIds = lib.concatLists (lib.mapAttrsToList checkMaintainer lib.maintainers);