lib.modules: Let module declare options directly in bare submodule

... where a bare submodule is an option that has a type like
`submoduleWith x`, as opposed to `attrsOf (submoduleWith x)`.

This makes migration unnecessary when introducing a freeform type
in an existing option tree.

Closes #146882
This commit is contained in:
Robert Hensing
2022-01-24 15:58:17 +01:00
parent 33e8df0921
commit d030e2109f
7 changed files with 75 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
{ lib, ... }:
let
inherit (lib) mkOption types;
in
{
options.bare-submodule = mkOption {
type = types.submoduleWith {
modules = [
{
options.nested = mkOption {
type = types.int;
default = 1;
};
}
];
};
};
}