1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/modules/meta.nix

55 lines
1.4 KiB
Nix
Raw Permalink Normal View History

2021-03-07 14:46:08 +00:00
# This module was derived from
# https://github.com/NixOS/nixpkgs/blob/000387627d26f245a6d9a0a7a60b7feddecaeec0/nixos/modules/misc/meta.nix
{ lib, ... }:
with lib;
let
maintainer = mkOptionType {
name = "maintainer";
check = email: elem email (attrValues lib.maintainers);
merge = loc: defs: listToAttrs (singleton (nameValuePair (last defs).file (last defs).value));
};
listOfMaintainers = types.listOf maintainer // {
# Returns list of
# { "module-file" = [
# "maintainer1 <first@nixos.org>"
# "maintainer2 <second@nixos.org>" ];
# }
merge = loc: defs:
zipAttrs
(flatten (imap1 (n: def: imap1 (m: def':
maintainer.merge (loc ++ ["[${toString n}-${toString m}]"])
[{ inherit (def) file; value = def'; }]) def.value) defs));
};
in
{
options = {
meta = {
maintainers = mkOption {
type = listOfMaintainers;
internal = true;
default = [];
2024-03-26 04:58:02 +00:00
example = [ lib.maintainers.lnl7 ];
2024-04-14 21:02:32 +00:00
description = ''
2021-03-07 14:46:08 +00:00
List of maintainers of each module. This option should be defined at
most once per module.
NOTE: `lib` comes from Nixpkgs, which can go out of
2021-03-07 14:46:08 +00:00
sync with nix-darwin. For this reason, use definitions like
`maintainers.alice or "alice"`.
2021-03-07 14:46:08 +00:00
'';
};
};
};
meta.maintainers = [
maintainers.roberth or "roberth"
];
}