Merge pull request 'feat(docs,api): expose inventory.instances interface' (#3721) from hsjobeki/clan-core:inventory-services-1 into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3721
This commit is contained in:
hsjobeki
2025-05-20 15:29:14 +00:00
7 changed files with 166 additions and 56 deletions

View File

@@ -359,9 +359,6 @@ in
};
instances = lib.mkOption {
# Keep as internal until all de-/serialization issues are resolved
visible = false;
internal = true;
description = "Multi host service module instances";
type = types.attrsOf (
types.submodule {
@@ -402,14 +399,7 @@ in
default = { };
};
tags = lib.mkOption {
type = types.attrsOf (
types.submodule {
options.settings = lib.mkOption {
default = { };
type = types.deferredModule;
};
}
);
type = types.attrsOf (types.submodule { });
default = { };
};
settings = lib.mkOption {

View File

@@ -304,6 +304,17 @@ rec {
# return jsonschema property definition for raw
then
exposedModuleInfo // default // example // description // { type = allBasicTypes; }
else if
# This is a special case for the deferred clan.service 'settings', we assume it is JSON serializable
# To get the type of a Deferred modules we need to know the interface of the place where it is evaluated.
# i.e. in case of a clan.service this is the interface of the service which dynamically changes depending on the service
# We assign "type" = []
# This means any value is valid — or like TypeScripts unknown.
# We can assign the type later, when we know the exact interface.
# tsType = "unknown" is a type that we preload for json2ts, such that it gets the correct type in typescript
(option.type.name == "deferredModule")
then
exposedModuleInfo // default // example // description // { tsType = "unknown"; }
# parse enum
else if
option.type.name == "enum"