clanServices: remove unnecessary localModules

This commit is contained in:
Johannes Kirschbauer
2025-06-30 16:02:56 +02:00
parent 65f01c72bd
commit 1e94fd18f8
5 changed files with 26 additions and 24 deletions

View File

@@ -2,11 +2,9 @@
{
moduleSpec,
flakeInputs,
localModuleSet,
clanCoreModules,
}:
let
inputName = if moduleSpec.input == null then "<clan>" else moduleSpec.input;
inputError = throw ''
Flake doesn't provide input with name '${moduleSpec.input}'
@@ -31,20 +29,27 @@ let
input =
if moduleSpec.input == null then
{ clan.modules = clanCoreModules; }
else if moduleSpec.input == "self" then
{ clan.modules = localModuleSet; }
else
flakeInputs.${moduleSpec.input} or inputError;
in
input.clan.modules
or (throw "flake input ${moduleSpec.input} doesn't export any clan services via the `clan.modules` output attribute");
or (throw "flake input '${moduleSpec.input}' doesn't export any clan services via the `clan.modules` output attribute");
resolvedModule =
resolvedModuleSet.${moduleSpec.name} or (throw ''
flake input '${inputName}' doesn't provide clan-module with name ${moduleSpec.name}.
${
lib.optionalString (
moduleSpec.input != null
) "flake input '${moduleSpec.input}' doesn't provide clan-module with name '${moduleSpec.name}'."
}${
lib.optionalString (
moduleSpec.input == null
) "clan-core doesn't provide clan-module with name '${moduleSpec.name}'."
}
Set `module.name = "self"` if the module is defined in your own flake.
Set `module.input = "self"` if the module is defined in your own flake.
Set `module.input = "<flake-input>" if the module is defined by a flake input called `<flake-input>`.
Unset `module.input` (or set module.input = null) - to use the clan-core module '${moduleSpec.name}'
'');
in
resolvedModule