From bec43177093a612246721df2726e1cf994b0bd5c Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 26 Mar 2025 17:14:44 +0100 Subject: [PATCH] feat(inventory/instances): init instances as new attribute for adding distributed services --- lib/inventory/build-inventory/interface.nix | 66 ++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/lib/inventory/build-inventory/interface.nix b/lib/inventory/build-inventory/interface.nix index fd5a472c2..2676bda1d 100644 --- a/lib/inventory/build-inventory/interface.nix +++ b/lib/inventory/build-inventory/interface.nix @@ -275,7 +275,71 @@ 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 { + options = { + # ModuleSpec + module = lib.mkOption { + type = types.submodule { + options.input = lib.mkOption { + type = types.nullOr types.str; + default = null; + defaultText = "Name of the input. Default to 'null' which means the module is local"; + description = '' + Name of the input. Default to 'null' which means the module is local + ''; + }; + options.name = lib.mkOption { + type = types.str; + }; + }; + }; + roles = lib.mkOption { + default = { }; + type = types.attrsOf ( + types.submodule { + options = { + # TODO: deduplicate + machines = lib.mkOption { + type = types.attrsOf ( + types.submodule { + options.settings = lib.mkOption { + default = { }; + type = types.deferredModule; + }; + } + ); + default = { }; + }; + tags = lib.mkOption { + type = types.attrsOf ( + types.submodule { + options.settings = lib.mkOption { + default = { }; + type = types.deferredModule; + }; + } + ); + default = { }; + }; + settings = lib.mkOption { + default = { }; + type = types.deferredModule; + }; + }; + } + ); + }; + }; + } + ); + default = { }; + }; services = lib.mkOption { description = '' Services of the inventory.