lib.evalModules: Add extendModules and type to result

Allows the simultaneous construction of top-level invocations and
submodule types.

This helps structure configuration systems integration code.
This commit is contained in:
Robert Hensing
2021-10-27 20:42:05 +02:00
parent 9ec8a16c79
commit dece37b83a
4 changed files with 85 additions and 33 deletions

View File

@@ -0,0 +1,28 @@
{ lib, ... }: {
options.submodule = lib.mkOption {
inherit (lib.evalModules {
modules = [
{
options.inner = lib.mkOption {
type = lib.types.bool;
default = false;
};
}
];
}) type;
default = {};
};
config.submodule = lib.mkMerge [
({ lib, ... }: {
options.outer = lib.mkOption {
type = lib.types.bool;
default = false;
};
})
{
inner = true;
outer = true;
}
];
}