File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333/lib/path/* @infinisil @hsjobeki
3434/lib/fileset @infinisil @hsjobeki
3535/maintainers/github-teams.json @infinisil
36+ /maintainers/computed-team-list.nix @infinisil
3637## Standard environment–related libraries
3738/lib/customisation.nix @alyssais @NixOS/stdenv
3839/lib/derivations.nix @alyssais @NixOS/stdenv
Original file line number Diff line number Diff line change 6363 customisation = callLibs ./customisation.nix ;
6464 derivations = callLibs ./derivations.nix ;
6565 maintainers = import ../maintainers/maintainer-list.nix ;
66- teams = callLibs ../maintainers/team-list.nix ;
66+ teams = callLibs ../maintainers/computed- team-list.nix ;
6767 meta = callLibs ./meta.nix ;
6868 versions = callLibs ./versions.nix ;
6969
Original file line number Diff line number Diff line change @@ -164,7 +164,6 @@ team after giving the existing members a few days to respond.
164164* Important:* If a team says it is a closed group, do not merge additions
165165to the team without an approval by at least one existing member.
166166
167-
168167# Maintainer scripts
169168
170169Various utility scripts, which are mainly useful for nixpkgs maintainers,
Original file line number Diff line number Diff line change 1+ # Extends ./team-list.nix with synced GitHub information from ./github-teams.json
2+ { lib } :
3+ let
4+ githubTeams = lib . importJSON ./github-teams.json ;
5+ teams = import ./team-list.nix { inherit lib ; } ;
6+
7+ # A fast maintainer id lookup table
8+ maintainersById = lib . pipe lib . maintainers [
9+ lib . attrValues
10+ ( lib . groupBy ( attrs : toString attrs . githubId ) )
11+ ( lib . mapAttrs ( _ : lib . head ) )
12+ ] ;
13+
14+ maintainerSetToList =
15+ githubTeam :
16+ lib . mapAttrsToList (
17+ login : id :
18+ maintainersById . ${ toString id }
19+ or ( throw "lib.teams: No maintainer entry for GitHub user @${ login } who's part of the @NixOS/${ githubTeam } team" )
20+ ) ;
21+
22+ in
23+ lib . mapAttrs (
24+ name : attrs :
25+ if attrs ? github then
26+ let
27+ githubTeam =
28+ githubTeams . ${ attrs . github }
29+ or ( throw "lib.teams.${ name } : Corresponding GitHub team ${ attrs . github } not known yet, make sure to create it and wait for the regular team sync" ) ;
30+ in
31+ assert lib . assertMsg ( ! attrs ? shortName )
32+ "lib.teams.${ name } : Both `shortName` and `github` is set, but the former is synced from the latter" ;
33+ assert lib . assertMsg (
34+ ! attrs ? scope
35+ ) "lib.teams.${ name } : Both `scope` and `github` is set, but the former is synced from the latter" ;
36+ assert lib . assertMsg (
37+ ! attrs ? members
38+ ) "lib.teams.${ name } : Both `members` and `github` is set, but the former is synced from the latter" ;
39+ attrs
40+ // {
41+ shortName = githubTeam . name ;
42+ scope = githubTeam . description ;
43+ members =
44+ maintainerSetToList attrs . github githubTeam . maintainers
45+ ++ maintainerSetToList attrs . github githubTeam . members ;
46+ }
47+ else
48+ attrs
49+ ) teams
You can’t perform that action at this time.
0 commit comments