clanServices: remove unnecessary localModules
This commit is contained in:
@@ -248,7 +248,7 @@ in
|
||||
{
|
||||
distributedServices = clanLib.inventory.mapInstances {
|
||||
inherit (config) inventory;
|
||||
inherit localModuleSet flakeInputs;
|
||||
inherit flakeInputs;
|
||||
clanCoreModules = clan-core.clan.modules;
|
||||
prefix = [ "distributedServices" ];
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
lib,
|
||||
clanLib
|
||||
clanLib,
|
||||
}:
|
||||
let
|
||||
services = clanLib.callLib ./distributed-service/inventory-adapter.nix { };
|
||||
|
||||
@@ -24,7 +24,6 @@ in
|
||||
flakeInputs,
|
||||
# The clan inventory
|
||||
inventory,
|
||||
localModuleSet,
|
||||
clanCoreModules,
|
||||
prefix ? [ ],
|
||||
}:
|
||||
@@ -37,7 +36,6 @@ in
|
||||
let
|
||||
resolvedModule = resolveModule {
|
||||
moduleSpec = instance.module;
|
||||
inherit localModuleSet;
|
||||
inherit flakeInputs clanCoreModules;
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,7 +27,12 @@ let
|
||||
];
|
||||
}).config;
|
||||
|
||||
callInventoryAdapter =
|
||||
inventoryModule:
|
||||
let
|
||||
inventory = evalInventory inventoryModule;
|
||||
flakeInputsFixture = {
|
||||
self.clan.modules = inventory.modules;
|
||||
# Example upstream module
|
||||
upstream.clan.modules = {
|
||||
uzzi = {
|
||||
@@ -38,17 +43,11 @@ let
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
callInventoryAdapter =
|
||||
inventoryModule:
|
||||
let
|
||||
inventory = evalInventory inventoryModule;
|
||||
in
|
||||
clanLib.inventory.mapInstances {
|
||||
clanCoreModules = { };
|
||||
flakeInputs = flakeInputsFixture;
|
||||
inherit inventory;
|
||||
localModuleSet = inventory.modules;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user