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,
# 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,
...
}:
@@ -31,7 +34,7 @@ lib.fix (
# ------------------------------------
# ClanLib functions
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 { };
test = clanLib.callLib ./test { };
# Custom types

View File

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

View File

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

View File

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

View File

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

View File

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