clanServices: remove unneeded self reference in lib

This commit is contained in:
Johannes Kirschbauer
2025-06-30 15:32:31 +02:00
parent bacff5c49f
commit 65f01c72bd
6 changed files with 14 additions and 11 deletions

View File

@@ -1,5 +1,8 @@
{ {
lib, lib,
# TODO: Get rid of self here.
# DONT add any new functions that depend on self here.
# If a lib function depends on a piece in clan-core add that piece to the function arguments
self, self,
... ...
}: }:
@@ -31,7 +34,7 @@ lib.fix (
# ------------------------------------ # ------------------------------------
# ClanLib functions # ClanLib functions
evalClan = clanLib.callLib ./modules/inventory/eval-clan-modules { }; evalClan = clanLib.callLib ./modules/inventory/eval-clan-modules { };
inventory = clanLib.callLib ./modules/inventory { clan-core = self; }; inventory = clanLib.callLib ./modules/inventory { };
modules = clanLib.callLib ./modules/inventory/frontmatter { }; modules = clanLib.callLib ./modules/inventory/frontmatter { };
test = clanLib.callLib ./test { }; test = clanLib.callLib ./test { };
# Custom types # Custom types

View File

@@ -249,6 +249,7 @@ in
distributedServices = clanLib.inventory.mapInstances { distributedServices = clanLib.inventory.mapInstances {
inherit (config) inventory; inherit (config) inventory;
inherit localModuleSet flakeInputs; inherit localModuleSet flakeInputs;
clanCoreModules = clan-core.clan.modules;
prefix = [ "distributedServices" ]; prefix = [ "distributedServices" ];
}; };
machines = config.distributedServices.allMachines; machines = config.distributedServices.allMachines;

View File

@@ -1,12 +1,9 @@
{ {
lib, lib,
clanLib, clanLib
clan-core,
}: }:
let let
services = clanLib.callLib ./distributed-service/inventory-adapter.nix { services = clanLib.callLib ./distributed-service/inventory-adapter.nix { };
inherit clan-core;
};
in in
{ {
inherit (services) mapInstances; inherit (services) mapInstances;

View File

@@ -12,11 +12,10 @@
{ {
lib, lib,
clanLib, clanLib,
clan-core,
... ...
}: }:
let let
resolveModule = import ./resolveModule.nix { inherit lib clan-core; }; resolveModule = import ./resolveModule.nix { inherit lib; };
in in
{ {
mapInstances = mapInstances =
@@ -26,6 +25,7 @@ in
# The clan inventory # The clan inventory
inventory, inventory,
localModuleSet, localModuleSet,
clanCoreModules,
prefix ? [ ], prefix ? [ ],
}: }:
let let
@@ -38,7 +38,7 @@ in
resolvedModule = resolveModule { resolvedModule = resolveModule {
moduleSpec = instance.module; moduleSpec = instance.module;
inherit localModuleSet; inherit localModuleSet;
inherit flakeInputs; inherit flakeInputs clanCoreModules;
}; };
# Every instance includes machines via roles # Every instance includes machines via roles

View File

@@ -1,8 +1,9 @@
{ lib, clan-core }: { lib }:
{ {
moduleSpec, moduleSpec,
flakeInputs, flakeInputs,
localModuleSet, localModuleSet,
clanCoreModules,
}: }:
let let
inputName = if moduleSpec.input == null then "<clan>" else moduleSpec.input; inputName = if moduleSpec.input == null then "<clan>" else moduleSpec.input;
@@ -29,7 +30,7 @@ let
let let
input = input =
if moduleSpec.input == null then if moduleSpec.input == null then
clan-core { clan.modules = clanCoreModules; }
else if moduleSpec.input == "self" then else if moduleSpec.input == "self" then
{ clan.modules = localModuleSet; } { clan.modules = localModuleSet; }
else else

View File

@@ -45,6 +45,7 @@ let
inventory = evalInventory inventoryModule; inventory = evalInventory inventoryModule;
in in
clanLib.inventory.mapInstances { clanLib.inventory.mapInstances {
clanCoreModules = { };
flakeInputs = flakeInputsFixture; flakeInputs = flakeInputsFixture;
inherit inventory; inherit inventory;
localModuleSet = inventory.modules; localModuleSet = inventory.modules;