modules/generic/meta-maintainers.nix: Check validity of meta.maintainers

And fix a case where it wasn't valid
This commit is contained in:
Silvan Mosberger 2026-02-07 16:41:58 +01:00
parent 516a14cd33
commit 3dc5545d51
3 changed files with 18 additions and 3 deletions

View file

@ -17,7 +17,14 @@ in
options = {
meta = {
maintainers = mkOption {
type = sourceList;
type =
let
allMaintainers = lib.attrValues lib.maintainers;
in
lib.types.addCheck sourceList (lib.all (v: lib.elem v allMaintainers))
// {
description = "list of lib.maintainers";
};
default = [ ];
example = lib.literalExpression "[ lib.maintainers.alice lib.maintainers.bob ]";
description = ''

View file

@ -14,9 +14,17 @@ let
};
in
rec {
lib = import ../../../lib;
# Inject ghost into lib.maintainers so it passes the addCheck validation
lib = (import ../../../lib).extend (
final: prev: {
maintainers = prev.maintainers // {
inherit ghost;
};
}
);
example = lib.evalModules {
specialArgs.lib = lib;
modules = [
../meta-maintainers.nix
{