clan: Add autoloaded clanModules from flake inputs. Rename 'directory' to 'self' in buildClan

This commit is contained in:
Qubasa
2025-01-24 12:32:04 +07:00
parent 559a95cdde
commit e36654daa1
14 changed files with 70 additions and 33 deletions

View File

@@ -197,7 +197,7 @@ let
machinesFromInventory :: Inventory -> { ${machine_name} :: NixOSConfiguration }
*/
buildInventory =
{ inventory, directory }:
{ inventory, self }:
# For every machine in the inventory, build a NixOS configuration
# For each machine generate config, forEach service, if the machine is used.
builtins.mapAttrs (
@@ -207,8 +207,8 @@ let
machineName
machineConfig
inventory
directory
;
directory = self;
}
) (inventory.machines or { });
in

View File

@@ -13,14 +13,14 @@ in
# Empty inventory should return an empty module
expr = buildInventory {
inventory = { };
directory = ./.;
self = ./.;
};
expected = { };
};
test_inventory_role_imports =
let
configs = buildInventory {
directory = ./.;
self = ./.;
inventory = {
modules = clan-core.clanModules;
services = {
@@ -62,7 +62,7 @@ in
test_inventory_tag_resolve =
let
configs = buildInventory {
directory = ./.;
self = ./.;
inventory = {
modules = clan-core.clanModules;
services = {
@@ -102,7 +102,7 @@ in
test_inventory_multiple_roles =
let
configs = buildInventory {
directory = ./.;
self = ./.;
inventory = {
modules = clan-core.clanModules;
services = {
@@ -132,7 +132,7 @@ in
test_inventory_module_doesnt_exist =
let
configs = buildInventory {
directory = ./.;
self = ./.;
inventory = {
modules = clan-core.clanModules;
services = {
@@ -157,7 +157,7 @@ in
test_inventory_role_doesnt_exist =
let
configs = buildInventory {
directory = ./.;
self = ./.;
inventory = {
modules = clan-core.clanModules;
services = {
@@ -183,7 +183,7 @@ in
test_inventory_tag_doesnt_exist =
let
configs = buildInventory {
directory = ./.;
self = ./.;
inventory = {
modules = clan-core.clanModules;
services = {
@@ -211,7 +211,7 @@ in
test_inventory_disabled_service =
let
configs = buildInventory {
directory = ./.;
self = ./.;
inventory = {
modules = clan-core.clanModules;
services = {