1# Nix script to lookup maintainer github handles from their email address. Used by ./hydra-report.hs.
2#
3# This script produces an attr set mapping of email addresses to GitHub handles:
4#
5# ```nix
6# > import ./maintainer-handles.nix
7# { "cdep.illabout@gmail.com" = "cdepillabout"; "john@smith.com" = "johnsmith"; ... }
8# ```
9#
10# This mapping contains all maintainers in ../../mainatainer-list.nix, but it
11# ignores maintainers who don't have a GitHub account or an email address.
12let
13 pkgs = import ../../.. { };
14 maintainers = import ../../maintainer-list.nix;
15 inherit (pkgs) lib;
16 mkMailGithubPair =
17 _: maintainer:
18 if (maintainer ? email) && (maintainer ? github) then
19 { "${maintainer.email}" = maintainer.github; }
20 else
21 { };
22in
23lib.zipAttrsWith (_: builtins.head) (lib.mapAttrsToList mkMailGithubPair maintainers)