Refactor(inventory/modules): add support for local clan.modules and migrate all checks

This commit is contained in:
Johannes Kirschbauer
2025-05-08 17:17:46 +02:00
parent 5b4a0a0311
commit b71e5378d6
7 changed files with 41 additions and 35 deletions

View File

@@ -45,7 +45,8 @@ let
inherit inventory directory;
flakeInputs = config.self.inputs;
prefix = config._prefix ++ [ "inventoryClass" ];
localModuleSet = config.modules;
# TODO: remove inventory.modules, this is here for backwards compatibility
localModuleSet = inventory.modules // config.modules;
}
);

View File

@@ -33,6 +33,7 @@ let
distributedServices = clanLib.inventory.mapInstances {
inherit (config) inventory;
inherit localModuleSet;
inherit flakeInputs;
prefix = prefix ++ [ "distributedServices" ];
};

View File

@@ -54,7 +54,7 @@ let
)
}
To import a local module from 'inventory.modules' remove the 'input' attribute from the module definition
To import a local module from 'clan.modules' remove the 'input' attribute from the module definition
Remove the following line from the module definition:
...
@@ -81,6 +81,7 @@ in
flakeInputs,
# The clan inventory
inventory,
localModuleSet,
prefix ? [ ],
}:
let
@@ -92,7 +93,7 @@ in
let
resolvedModule = resolveModule {
moduleSpec = instance.module;
localModuleSet = inventory.modules;
inherit localModuleSet;
inherit flakeInputs;
};

View File

@@ -41,9 +41,13 @@ let
callInventoryAdapter =
inventoryModule:
let
inventory = evalInventory inventoryModule;
in
clanLib.inventory.mapInstances {
flakeInputs = flakeInputsFixture;
inventory = evalInventory inventoryModule;
inherit inventory;
localModuleSet = inventory.modules;
};
in
{