Skip to content

Commit

Permalink
Better resources schema
Browse files Browse the repository at this point in the history
  • Loading branch information
infinisil committed Feb 22, 2024
1 parent 4208078 commit 665a359
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 69 deletions.
75 changes: 15 additions & 60 deletions data.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,89 +23,44 @@
resources = {
twitter = {
name = "Twitter account";
parts = [
{
type = "account";
website = "twitter.com";
name = "nixos_org";
}
];
owner = "marketing";
kind = "account";
website = "https://twitter.com/nixos_org";
};
mastodon = {
name = "Mastodon account";
parts = [
{
type = "account";
website = "chaos.social";
name = "nixos_org";
}
];
owner = "marketing";
kind = "account";
website = "https://mastodon.social/@[email protected]";
};
youtube = {
name = "YouTube account";
parts = [
{
type = "account";
website = "youtube.com";
name = "NixOS-Foundation";
}
];
owner = "marketing";
kind = "account";
website = "https://www.youtube.com/@NixOS-Foundation";
};
opencollective = {
name = "OpenCollective account";
parts = [
{
type = "account";
website = "opencollective.com";
name = "nixos";
}
];
owner = "foundation";
kind = "account";
website = "https://opencollective.com/nixos";
};
foundation = {
name = "Legal foundation";
parts = [
{
type = "legal";
website = "https://www.kvk.nl/";
registrationNumber = "63520583";
}
];
owner = "foundation";
kind = "legal";
website = "https://www.kvk.nl/bestellen/#/63520583";
};
github = {
name = "GitHub organisation";
parts = [
{
type = "account";
website = "github.com";
name = "NixOS";
}
{
type = "account";
website = "github.com";
name = "NixCon";
}
];
owner = "github";
kind = "account";
website = "https://github.com/NixOS";
};
infra = {
name = "Infrastructure";
parts = [
{
type = "GitHub";
owner = "NixOS";
repo = "infra";
}
{
type = "DNS zone";
zone = "nixos.org";
}
];
"nixos.org" = {
name = "nixos.org DNS zone";
owner = "infra";
kind = "account";
};
};

Expand Down
21 changes: 12 additions & 9 deletions schema.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,20 @@ in
options.name = lib.mkOption {
type = types.str;
};
options.parts = lib.mkOption {
type = types.listOf (types.attrsOf types.str);
};
options.owner = lib.mkOption {
type = types.str;
};
options.kind = lib.mkOption {
type = types.enum [ "account" "legal" "GitHub" ];
};
options.website = lib.mkOption {
type = types.nullOr types.str;
default = null;
};
options.extraInfo = lib.mkOption {
type = types.attrsOf types.str;
default = {};
};
});
};

Expand Down Expand Up @@ -81,12 +89,7 @@ in
Owner: [${config.teams.${resource.owner}.name}](#${toMarkdownAnchor config.teams.${resource.owner}.name})
Parts:
${lib.concatMapStrings (part: ''
- ${lib.concatStringsSep "\n " (lib.mapAttrsToList (name: value:
"${name}: ${value}"
) part)}
'') resource.parts}
${lib.optionalString (resource.website != null) "Website: ${resource.website}"}
'') config.resources)
}
Expand Down

0 comments on commit 665a359

Please sign in to comment.