lib/values: fix submodule and submoduleWith with external modules

This commit is contained in:
Johannes Kirschbauer
2024-12-06 21:01:27 +01:00
parent 4444c4a5c2
commit cd233fbacb
2 changed files with 43 additions and 10 deletions

View File

@@ -36,7 +36,10 @@ let
options = filteredSubOptions;
modules = (
[
{ inherit options; }
{
inherit options;
_file = "<artifical submodule>";
}
]
++ map (config: { inherit config; }) defs.${attrName}
);
@@ -63,13 +66,7 @@ let
submodulePrios =
let
options = filteredSubOptions;
modules = (
[
{ inherit options; }
]
++ opt.definitions
);
modules = (opt.definitions ++ opt.type.getSubModules);
submoduleEval = lib.evalModules {
inherit modules;
};
@@ -80,8 +77,8 @@ let
if opt ? type && opt.type.name == "submodule" then
(prio) // submodulePrios
else if opt ? type && opt.type.name == "attrsOf" then
prio // (
prioPerValue {
prio
// (prioPerValue {
type = opt.type;
defs = zipDefs opt.definitions;
} (lib.modules.mergeAttrDefinitionsWithPrio opt))