Clan-cli/api: list external modules
This commit is contained in:
@@ -2,17 +2,10 @@
|
|||||||
self,
|
self,
|
||||||
self',
|
self',
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
||||||
# { mName :: { roleName :: Options } }
|
|
||||||
# getModulesSchema = modules: lib.mapAttrs (
|
|
||||||
# _moduleName: rolesOptions:
|
|
||||||
# lib.mapAttrs (_roleName: options: jsonWithoutHeader.parseOptions options { }) rolesOptions
|
|
||||||
# ) (self.lib.evalClanModulesWithRoles modules);
|
|
||||||
|
|
||||||
modulesSchema = self.lib.modules.getModulesSchema self.clanModules;
|
modulesSchema = self.lib.modules.getModulesSchema self.clanModules;
|
||||||
|
|
||||||
jsonLib = self.lib.jsonschema { inherit includeDefaults; };
|
jsonLib = self.lib.jsonschema { inherit includeDefaults; };
|
||||||
@@ -49,7 +42,6 @@ in
|
|||||||
frontMatterSchema
|
frontMatterSchema
|
||||||
inventorySchema
|
inventorySchema
|
||||||
modulesSchema
|
modulesSchema
|
||||||
getModulesSchema
|
|
||||||
renderSchema
|
renderSchema
|
||||||
inventory-schema-abstract
|
inventory-schema-abstract
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class ModuleInfo:
|
|||||||
def get_modules(base_path: str) -> dict[str, str]:
|
def get_modules(base_path: str) -> dict[str, str]:
|
||||||
cmd = nix_eval(
|
cmd = nix_eval(
|
||||||
[
|
[
|
||||||
f"{base_path}#clanInternals.clanModules",
|
f"{base_path}#clanInternals.inventory.modules",
|
||||||
"--json",
|
"--json",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -153,11 +153,11 @@ def get_modules(base_path: str) -> dict[str, str]:
|
|||||||
proc = run_no_stdout(cmd)
|
proc = run_no_stdout(cmd)
|
||||||
res = proc.stdout.strip()
|
res = proc.stdout.strip()
|
||||||
except ClanCmdError as e:
|
except ClanCmdError as e:
|
||||||
msg = "clanInternals might not have clanModules attributes"
|
msg = "clanInternals might not have inventory.modules attributes"
|
||||||
raise ClanError(
|
raise ClanError(
|
||||||
msg,
|
msg,
|
||||||
location=f"list_modules {base_path}",
|
location=f"list_modules {base_path}",
|
||||||
description="Evaluation failed on clanInternals.clanModules attribute",
|
description="Evaluation failed on clanInternals.inventory.modules attribute",
|
||||||
) from e
|
) from e
|
||||||
modules: dict[str, str] = json.loads(res)
|
modules: dict[str, str] = json.loads(res)
|
||||||
return modules
|
return modules
|
||||||
|
|||||||
Reference in New Issue
Block a user