Skip to content

Commit

Permalink
More links between resources, teams and people
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil committed Feb 22, 2024
1 parent 665a359 commit 0ce774e
Showing 1 changed file with 34 additions and 5 deletions.
39 changes: 34 additions & 5 deletions schema.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ in
};

options.teams = lib.mkOption {
type = types.attrsOf (types.submodule {
type = types.attrsOf (types.submodule ({ name, ... }: {
options.name = lib.mkOption {
type = types.str;
};
Expand All @@ -57,11 +57,17 @@ in
options.homepage = lib.mkOption {
type = types.str;
};
});

options.resourcesOwned = lib.mkOption {
type = types.listOf types.str;
readOnly = true;
default = lib.attrNames (lib.filterAttrs (resourceId: resource: resource.owner == name) config.resources);
};
}));
};

options.people = lib.mkOption {
type = types.attrsOf (types.submodule {
type = types.attrsOf (types.submodule ({ name, ... }: {
options.name = lib.mkOption {
type = types.str;
};
Expand All @@ -71,7 +77,12 @@ in
options.github = lib.mkOption {
type = types.str;
};
});
options.teams = lib.mkOption {
readOnly = true;
type = types.listOf types.str;
default = lib.attrNames (lib.filterAttrs (teamId: team: lib.elem name team.members) config.teams);
};
}));
};

options.readme = lib.mkOption {
Expand Down Expand Up @@ -113,19 +124,37 @@ in
- [${member}](#${toMarkdownAnchor config.people.${member}.name})${lib.optionalString (team.leader == member) " (leader)"}
'') team.members}
Resources owned:
${lib.concatMapStrings (resourceId:
let
resource = config.resources.${resourceId};
in ''
- [${resource.name}](#${toMarkdownAnchor resource.name})
''
) team.resourcesOwned}
'') config.teams)
}
## People
${
lib.concatStrings (lib.mapAttrsToList (name: person: ''
lib.concatStrings (lib.mapAttrsToList (personId: person: ''
### ${person.name}
Email: [${person.email}](mailto:${person.email})
GitHub: [@${person.github}](https://github.com/${person.github})
Included in teams:
${lib.concatMapStrings (teamId:
let
team = config.teams.${teamId};
in ''
- [${team.name}](#${toMarkdownAnchor team.name})${lib.optionalString (team.leader == personId) " (leader)"}
''
) person.teams}
'') config.people)
}
Expand Down

0 comments on commit 0ce774e

Please sign in to comment.