From b87d5a238c3b0e6c0e5f6e508cf94beb017a8a61 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Sun, 27 Apr 2025 13:14:09 +0200 Subject: [PATCH] chore: remove unused moduleSchemas and related API endpoint for legacy modules We didn't reach the state where we would display these schemas in the UI. We might need to wire this up in a similar way for the newer clan.services --- lib/build-clan/interface.nix | 1 - lib/build-clan/module.nix | 6 ------ pkgs/clan-cli/clan_lib/api/modules.py | 22 ---------------------- 3 files changed, 29 deletions(-) diff --git a/lib/build-clan/interface.nix b/lib/build-clan/interface.nix index bcab2a621..405be0470 100644 --- a/lib/build-clan/interface.nix +++ b/lib/build-clan/interface.nix @@ -158,7 +158,6 @@ in # all exported clan modules from this clan modules = lib.mkOption { type = lib.types.raw; }; # all inventory module schemas - moduleSchemas = lib.mkOption { type = lib.types.raw; }; inventoryFile = lib.mkOption { type = lib.types.raw; }; # The machine 'imports' generated by the inventory per machine inventoryClass = lib.mkOption { type = lib.types.raw; }; diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index a6a40fde0..a72c00c41 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -193,12 +193,6 @@ in name: _: inventory.machines.${name}.machineClass or "nixos" == "darwin" ) (config.outputs.moduleForMachine); - moduleSchemas = clan-core.clanLib.modules.getModulesSchema { - modules = config.inventory.modules; - # TODO: make this function system agnostic - pkgs = nixpkgs.legacyPackages."x86_64-linux"; - inherit clan-core; - }; inherit inventoryClass; # TODO: unify this interface diff --git a/pkgs/clan-cli/clan_lib/api/modules.py b/pkgs/clan-cli/clan_lib/api/modules.py index d1205a3e5..3125cbb86 100644 --- a/pkgs/clan-cli/clan_lib/api/modules.py +++ b/pkgs/clan-cli/clan_lib/api/modules.py @@ -174,28 +174,6 @@ def get_modules(base_path: str) -> dict[str, str]: return modules -@API.register -def get_module_interface(base_path: str, module_name: str) -> dict[str, Any]: - """ - Check if a module exists and returns the interface schema - Returns an error if the module does not exist or has an incorrect interface - """ - cmd = nix_eval([f"{base_path}#clanInternals.moduleSchemas.{module_name}", "--json"]) - try: - proc = run_no_stdout(cmd) - res = proc.stdout.strip() - except ClanCmdError as e: - msg = "clanInternals might not have moduleSchemas attributes" - raise ClanError( - msg, - location=f"list_modules {base_path}", - description="Evaluation failed on clanInternals.moduleSchemas attribute", - ) from e - modules_schema: dict[str, Any] = json.loads(res) - - return modules_schema - - @API.register def list_modules(base_path: str) -> dict[str, ModuleInfo]: """