clanServices: remove unnecessary localModules
This commit is contained in:
@@ -248,7 +248,7 @@ in
|
|||||||
{
|
{
|
||||||
distributedServices = clanLib.inventory.mapInstances {
|
distributedServices = clanLib.inventory.mapInstances {
|
||||||
inherit (config) inventory;
|
inherit (config) inventory;
|
||||||
inherit localModuleSet flakeInputs;
|
inherit flakeInputs;
|
||||||
clanCoreModules = clan-core.clan.modules;
|
clanCoreModules = clan-core.clan.modules;
|
||||||
prefix = [ "distributedServices" ];
|
prefix = [ "distributedServices" ];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
clanLib
|
clanLib,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
services = clanLib.callLib ./distributed-service/inventory-adapter.nix { };
|
services = clanLib.callLib ./distributed-service/inventory-adapter.nix { };
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ in
|
|||||||
flakeInputs,
|
flakeInputs,
|
||||||
# The clan inventory
|
# The clan inventory
|
||||||
inventory,
|
inventory,
|
||||||
localModuleSet,
|
|
||||||
clanCoreModules,
|
clanCoreModules,
|
||||||
prefix ? [ ],
|
prefix ? [ ],
|
||||||
}:
|
}:
|
||||||
@@ -37,7 +36,6 @@ in
|
|||||||
let
|
let
|
||||||
resolvedModule = resolveModule {
|
resolvedModule = resolveModule {
|
||||||
moduleSpec = instance.module;
|
moduleSpec = instance.module;
|
||||||
inherit localModuleSet;
|
|
||||||
inherit flakeInputs clanCoreModules;
|
inherit flakeInputs clanCoreModules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,9 @@
|
|||||||
{
|
{
|
||||||
moduleSpec,
|
moduleSpec,
|
||||||
flakeInputs,
|
flakeInputs,
|
||||||
localModuleSet,
|
|
||||||
clanCoreModules,
|
clanCoreModules,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inputName = if moduleSpec.input == null then "<clan>" else moduleSpec.input;
|
|
||||||
inputError = throw ''
|
inputError = throw ''
|
||||||
Flake doesn't provide input with name '${moduleSpec.input}'
|
Flake doesn't provide input with name '${moduleSpec.input}'
|
||||||
|
|
||||||
@@ -31,20 +29,27 @@ let
|
|||||||
input =
|
input =
|
||||||
if moduleSpec.input == null then
|
if moduleSpec.input == null then
|
||||||
{ clan.modules = clanCoreModules; }
|
{ clan.modules = clanCoreModules; }
|
||||||
else if moduleSpec.input == "self" then
|
|
||||||
{ clan.modules = localModuleSet; }
|
|
||||||
else
|
else
|
||||||
flakeInputs.${moduleSpec.input} or inputError;
|
flakeInputs.${moduleSpec.input} or inputError;
|
||||||
in
|
in
|
||||||
input.clan.modules
|
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 =
|
resolvedModule =
|
||||||
resolvedModuleSet.${moduleSpec.name} or (throw ''
|
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>`.
|
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
|
in
|
||||||
resolvedModule
|
resolvedModule
|
||||||
|
|||||||
@@ -27,28 +27,27 @@ let
|
|||||||
];
|
];
|
||||||
}).config;
|
}).config;
|
||||||
|
|
||||||
flakeInputsFixture = {
|
|
||||||
# Example upstream module
|
|
||||||
upstream.clan.modules = {
|
|
||||||
uzzi = {
|
|
||||||
_class = "clan.service";
|
|
||||||
manifest = {
|
|
||||||
name = "uzzi-from-upstream";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
callInventoryAdapter =
|
callInventoryAdapter =
|
||||||
inventoryModule:
|
inventoryModule:
|
||||||
let
|
let
|
||||||
inventory = evalInventory inventoryModule;
|
inventory = evalInventory inventoryModule;
|
||||||
|
flakeInputsFixture = {
|
||||||
|
self.clan.modules = inventory.modules;
|
||||||
|
# Example upstream module
|
||||||
|
upstream.clan.modules = {
|
||||||
|
uzzi = {
|
||||||
|
_class = "clan.service";
|
||||||
|
manifest = {
|
||||||
|
name = "uzzi-from-upstream";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
clanLib.inventory.mapInstances {
|
clanLib.inventory.mapInstances {
|
||||||
clanCoreModules = { };
|
clanCoreModules = { };
|
||||||
flakeInputs = flakeInputsFixture;
|
flakeInputs = flakeInputsFixture;
|
||||||
inherit inventory;
|
inherit inventory;
|
||||||
localModuleSet = inventory.modules;
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user