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:
28
lib/tests/modules/declare-submodule-via-evalModules.nix
Normal file
28
lib/tests/modules/declare-submodule-via-evalModules.nix
Normal 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;
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user