core/lib/tests/modules/freeform-submodules.nix

25 lines
531 B
Nix
Raw Normal View History

2024-06-30 08:16:52 +00:00
{ lib, options, ... }:
with lib.types;
{
2024-05-01 22:14:04 +00:00
options.fooDeclarations = lib.mkOption {
2024-06-30 08:16:52 +00:00
default = (options.free.type.getSubOptions [ ])._freeformOptions.foo.declarations;
2024-05-01 22:14:04 +00:00
};
options.free = lib.mkOption {
type = submodule {
config._module.freeformType = lib.mkMerge [
(attrsOf (submodule {
2024-06-30 08:16:52 +00:00
options.foo = lib.mkOption { };
2024-05-01 22:14:04 +00:00
}))
(attrsOf (submodule {
2024-06-30 08:16:52 +00:00
options.bar = lib.mkOption { };
2024-05-01 22:14:04 +00:00
}))
];
};
};
config.free.xxx.foo = 10;
config.free.yyy.bar = 10;
}