Merge pull request 'Feat(inventory): simplify instance module spec, by applying a default' (#4054) from hsjobeki/module-default into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4054
This commit is contained in:
hsjobeki
2025-06-23 14:21:55 +00:00
2 changed files with 91 additions and 82 deletions

View File

@@ -373,7 +373,11 @@ in
instances = lib.mkOption {
description = "Multi host service module instances";
type = types.attrsOf (
types.submodule {
types.submoduleWith {
modules = [
(
{ name, ... }:
{
options = {
# ModuleSpec
module = lib.mkOption {
@@ -388,8 +392,10 @@ in
};
options.name = lib.mkOption {
type = types.str;
default = name;
};
};
default = { };
};
roles = lib.mkOption {
default = { };
@@ -465,6 +471,9 @@ in
};
};
}
)
];
}
);
default = { };
};

View File

@@ -15,12 +15,12 @@ class Unknown:
pass
InventoryInstanceModuleNameType = str
InventoryInstanceModuleInputType = str
InventoryInstanceModuleNameType = str
class InventoryInstanceModule(TypedDict):
name: str
input: NotRequired[InventoryInstanceModuleInputType]
name: NotRequired[InventoryInstanceModuleNameType]