chore(lib/getModuleClass): remove unused library function
This commit is contained in:
@@ -39,45 +39,4 @@
|
||||
acc ++ tagMembers
|
||||
) [ ] members.tags or [ ]);
|
||||
};
|
||||
/**
|
||||
Checks whether a module has a specific class
|
||||
|
||||
# Arguments
|
||||
- `module` The module to check.
|
||||
|
||||
# Returns
|
||||
- `string` | null: The specified class, or null if the class is not set
|
||||
|
||||
# Throws
|
||||
- If the module is not a valid module
|
||||
- If the module has a type that is not supported
|
||||
*/
|
||||
getModuleClass =
|
||||
module:
|
||||
let
|
||||
loadModuleForClassCheck =
|
||||
m:
|
||||
# Logic path adapted from nixpkgs/lib/modules.nix
|
||||
if lib.isFunction m then
|
||||
let
|
||||
args = lib.functionArgs m;
|
||||
in
|
||||
m args
|
||||
else if lib.isAttrs m then
|
||||
# module doesn't have a _type attribute
|
||||
if m._type or "module" == "module" then
|
||||
m
|
||||
# module has a _type set but it is not "module"
|
||||
else if m._type == "if" || m._type == "override" then
|
||||
throw "Module modifiers are not supported yet. Got: ${m._type}"
|
||||
else
|
||||
throw "Unsupported module type ${lib.typeOf m}"
|
||||
else if lib.isList m then
|
||||
throw "Invalid or unsupported module type ${lib.typeOf m}"
|
||||
else
|
||||
import m;
|
||||
|
||||
loaded = loadModuleForClassCheck module;
|
||||
in
|
||||
if loaded ? _class then loaded._class else null;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ let
|
||||
resolvedModule =
|
||||
resolvedModuleSet.${instance.module.name}
|
||||
or (throw "flake doesn't provide clan-module with name ${instance.module.name}");
|
||||
moduleClass = clanLib.inventory.getModuleClass resolvedModule;
|
||||
|
||||
# Every instance includes machines via roles
|
||||
# :: { client :: ... }
|
||||
@@ -113,7 +112,7 @@ let
|
||||
in
|
||||
{
|
||||
inherit (instance) module;
|
||||
inherit resolvedModule instanceRoles moduleClass;
|
||||
inherit resolvedModule instanceRoles;
|
||||
}
|
||||
) inventory.instances;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user