From 4e39849611af4d5d53bd35fac73ee56b52010fd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Thu, 5 Jan 2023 14:34:07 +0100 Subject: [PATCH] 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. --- lib/tests/maintainer-module.nix | 3 ++- lib/tests/maintainers.nix | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/tests/maintainer-module.nix b/lib/tests/maintainer-module.nix index 8cf8411b476a..afa12587a98d 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 8a9a2b26efaf..f82b63649b1f 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);