lib/values: fix submodule definition merging

This commit is contained in:
Johannes Kirschbauer
2024-12-06 19:53:34 +01:00
parent 388455038a
commit cc1eaf53ae
4 changed files with 84 additions and 28 deletions

View File

@@ -80,6 +80,56 @@ in
};
};
test_submodule_with_merging =
let
evaluated = (
eval [
{
options.foo = lib.mkOption {
type = lib.types.submodule {
options = {
normal = lib.mkOption {
type = lib.types.bool;
};
default = lib.mkOption {
type = lib.types.bool;
};
optionDefault = lib.mkOption {
type = lib.types.bool;
default = true;
};
unset = lib.mkOption {
type = lib.types.bool;
};
};
};
};
}
{
foo.default = lib.mkDefault true;
}
{
foo.normal = false;
}
]
);
in
{
inherit evaluated;
expr = slib.getPrios {
options = evaluated.options;
};
expected = {
foo = {
__prio = 100;
normal.__prio = 100; # Set via other module
default.__prio = 1000;
optionDefault.__prio = 1500;
unset.__prio = 9999;
};
};
};
# TODO(@hsjobeki): Cover this edge case
# test_freeform =
# let