lib.maintainers: Require uniqueness of github[Id], email and matrix fields (#488851)

This commit is contained in:
Silvan Mosberger 2026-02-16 20:57:43 +00:00 committed by GitHub
commit 9895f5057d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 17 deletions

View file

@ -54,6 +54,32 @@ let
missingGithubIds = lib.concatLists (lib.mapAttrsToList checkMaintainer lib.maintainers);
uniqueFields = [
"github"
"githubId"
"email"
"matrix"
];
nonUniqueFields = lib.filterAttrs (field: nonUnique: nonUnique != { }) (
lib.genAttrs uniqueFields (
field:
lib.pipe lib.maintainers [
(lib.mapAttrsToList (handle: m: m // { inherit handle; }))
(lib.groupBy (m: toString (m.${field} or null)))
(lib.filterAttrs (v: ms: v != "" && lib.length ms > 1))
(lib.mapAttrs (v: ms: map (m: m.handle) ms))
]
)
);
uniquenessError =
value:
if nonUniqueFields == { } then
value
else
throw "lib.maintainers has non-unique fields: ${lib.generators.toPretty { } nonUniqueFields}";
success = pkgs.runCommand "checked-maintainers-success" { } "mkdir $out";
failure =
@ -73,4 +99,4 @@ let
exit 1
'';
in
if missingGithubIds == [ ] then success else failure
uniquenessError (if missingGithubIds == [ ] then success else failure)

View file

@ -6942,13 +6942,6 @@
githubId = 126339;
name = "Domen Kozar";
};
DomesticMoth = {
name = "Andrew";
email = "silkmoth@protonmail.com";
github = "asciimoth";
githubId = 91414737;
keys = [ { fingerprint = "7D6B AE0A A98A FDE9 3396 E721 F87E 15B8 3AA7 3087"; } ];
};
dominikh = {
email = "dominik@honnef.co";
github = "dominikh";
@ -7747,7 +7740,7 @@
name = "Elnu";
};
elpdt852 = {
email = "nix@pdtpartners.com";
email = "nix+elpdt852@pdtpartners.com";
github = "elpdt852";
githubId = 122112154;
name = "Edgar Lee";
@ -14743,7 +14736,7 @@
name = "Luka Blaskovic";
};
lbpdt = {
email = "nix@pdtpartners.com";
email = "nix+lbpdt@pdtpartners.com";
github = "lbpdt";
githubId = 45168934;
name = "Louis Blin";
@ -18238,7 +18231,7 @@
keys = [ { fingerprint = "5658 4D09 71AF E45F CC29 6BD7 4CE6 2A90 EFC0 B9B2"; } ];
};
mupdt = {
email = "nix@pdtpartners.com";
email = "nix+mupdt@pdtpartners.com";
github = "mupdt";
githubId = 25388474;
name = "Matej Urbas";
@ -20434,12 +20427,6 @@
name = "Patrick";
keys = [ { fingerprint = "5E4C 3D74 80C2 35FE 2F0B D23F 7DD6 A72E C899 617D"; } ];
};
patricksjackson = {
email = "patrick@jackson.dev";
github = "arcuru";
githubId = 160646;
name = "Patrick Jackson";
};
patryk27 = {
email = "pwychowaniec@pm.me";
github = "Patryk27";