diff --git a/lib/build-clan/interface.nix b/lib/build-clan/interface.nix index 405be0470..cef079c5e 100644 --- a/lib/build-clan/interface.nix +++ b/lib/build-clan/interface.nix @@ -152,7 +152,6 @@ in # Those options are interfaced by the CLI # We don't specify the type here, for better performance. inventory = lib.mkOption { type = lib.types.raw; }; - inventoryValuesPrios = lib.mkOption { type = lib.types.raw; }; # all exported clan templates from this clan templates = lib.mkOption { type = lib.types.raw; }; # all exported clan modules from this clan diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index a72c00c41..000189e7e 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -201,14 +201,12 @@ in modules = config.modules; inherit inventoryFile; - inventoryValuesPrios = - # Temporary workaround - builtins.removeAttrs (clan-core.clanLib.introspection.getPrios { options = inventory.options; }) - # tags are freeformType which is not supported yet. - [ "tags" ]; templates = config.templates; inventory = config.inventory; + # TODO: Remove this in about a month + # It is only here for backwards compatibility for people with older CLI versions + inventoryValuesPrios = inventoryClass.introspection; meta = config.inventory.meta; source = "${clan-core}"; diff --git a/lib/inventory/build-inventory/default.nix b/lib/inventory/build-inventory/default.nix index 1a4997873..b5aee39ff 100644 --- a/lib/inventory/build-inventory/default.nix +++ b/lib/inventory/build-inventory/default.nix @@ -33,6 +33,7 @@ let }) config.distributedServices.allMachines; } ) + (lib.modules.importApply ./inventory-introspection.nix { inherit clanLib; }) ]; }).config; in diff --git a/lib/inventory/build-inventory/inventory-introspection.nix b/lib/inventory/build-inventory/inventory-introspection.nix new file mode 100644 index 000000000..ea7cf2938 --- /dev/null +++ b/lib/inventory/build-inventory/inventory-introspection.nix @@ -0,0 +1,17 @@ +{ clanLib }: +{ + config, + options, + lib, + ... +}: +{ + options.introspection = lib.mkOption { + readOnly = true; + # TODO: use options.inventory instead of the evaluate config attribute + default = + builtins.removeAttrs (clanLib.introspection.getPrios { options = config.inventory.options; }) + # tags are freeformType which is not supported yet. + [ "tags" ]; + }; +} diff --git a/pkgs/clan-cli/clan_cli/inventory/__init__.py b/pkgs/clan-cli/clan_cli/inventory/__init__.py index 43a0d6479..76f558785 100644 --- a/pkgs/clan-cli/clan_cli/inventory/__init__.py +++ b/pkgs/clan-cli/clan_cli/inventory/__init__.py @@ -375,7 +375,7 @@ def get_inventory_current_priority(flake_dir: str | Path) -> dict: """ cmd = nix_eval( [ - f"{flake_dir}#clanInternals.inventoryValuesPrios", + f"{flake_dir}#clanInternals.inventoryClass.introspection", "--json", ] )