Merge pull request 'Chore: remove unused legacy endpoints' (#3418) from hsjobeki/clan-core:chores-remove-unused into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3418
This commit is contained in:
@@ -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; };
|
||||
|
||||
@@ -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
|
||||
@@ -209,7 +203,7 @@ in
|
||||
inherit inventoryFile;
|
||||
inventoryValuesPrios =
|
||||
# Temporary workaround
|
||||
builtins.removeAttrs (clan-core.clanLib.values.getPrios { options = inventory.options; })
|
||||
builtins.removeAttrs (clan-core.clanLib.introspection.getPrios { options = inventory.options; })
|
||||
# tags are freeformType which is not supported yet.
|
||||
[ "tags" ];
|
||||
|
||||
|
||||
@@ -28,8 +28,11 @@ lib.fix (clanLib: {
|
||||
test = clanLib.callLib ./test { };
|
||||
|
||||
# Plain imports.
|
||||
values = import ./introspection { inherit lib; };
|
||||
introspection = import ./introspection { inherit lib; };
|
||||
jsonschema = import ./jsonschema { inherit lib; };
|
||||
inherit (self.inputs.nix-select.lib) parseSelector applySelectors select;
|
||||
facts = import ./facts.nix { inherit lib; };
|
||||
|
||||
# Passthrough from self.inputs
|
||||
# TODO: Can we make these agnostic from the name of the input?
|
||||
inherit (self.inputs.nix-select.lib) parseSelector applySelectors select;
|
||||
})
|
||||
|
||||
@@ -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]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user