feat(buildInventory): move instance resolution into buildInventory

Such that buildClan doesn't have to compose the results
buildInventory should be more self contained. But it is NOT meant a
public API! use buildClan argument 'inventory' instead
This commit is contained in:
Johannes Kirschbauer
2025-04-09 17:28:17 +02:00
parent 5705200406
commit 9f159084cd
4 changed files with 31 additions and 13 deletions

View File

@@ -9,6 +9,9 @@ in
directory = mkOption {
type = types.path;
};
distributedServices = mkOption {
type = types.raw;
};
inventory = mkOption {
type = types.raw;
};

View File

@@ -8,7 +8,11 @@ let
machinesFromInventory :: Inventory -> { ${machine_name} :: NixOSConfiguration }
*/
buildInventory =
{ inventory, directory }:
{
inventory,
directory,
flakeInputs,
}:
(lib.evalModules {
specialArgs = {
inherit clanLib;
@@ -16,6 +20,19 @@ let
modules = [
./builder
{ inherit directory inventory; }
(
# config.distributedServices.allMachines.${name} or [ ];
{ config, ... }:
{
distributedServices = clanLib.inventory.mapInstances {
inherit (config) inventory;
inherit flakeInputs;
};
machines = lib.mapAttrs (machineName: v: {
machineImports = v;
}) config.distributedServices.allMachines;
}
)
];
}).config;
in