diff --git a/lib/inventory/build-inventory/default.nix b/lib/inventory/build-inventory/default.nix index 88fe066df..fce8f5e67 100644 --- a/lib/inventory/build-inventory/default.nix +++ b/lib/inventory/build-inventory/default.nix @@ -93,7 +93,6 @@ let roleServiceConfigs = builtins.map ( role: serviceConfig.roles.${role}.config or { } ) inverseRoles.${machineName} or [ ]; - dbg = v: lib.traceSeq v v; customImports = map (s: "${directory}/${s}") ( globalImports ++ machineImports ++ roleServiceImports @@ -104,7 +103,7 @@ let acc2 ++ [ { - imports = dbg ([ clan-core.clanModules.${moduleName} ] ++ roleModules ++ customImports); + imports = [ clan-core.clanModules.${moduleName} ] ++ roleModules ++ customImports; config.clan.${moduleName} = lib.mkMerge ( [ globalConfig diff --git a/lib/inventory/build-inventory/interface.nix b/lib/inventory/build-inventory/interface.nix index 34a3c1e89..0ceb62e72 100644 --- a/lib/inventory/build-inventory/interface.nix +++ b/lib/inventory/build-inventory/interface.nix @@ -43,7 +43,6 @@ let importsOption = lib.mkOption { default = [ ]; type = t.listOf t.str; - # apply = map (pathOrString: "${pathOrString}"); }; in { diff --git a/lib/inventory/tests/default.nix b/lib/inventory/tests/default.nix index 14eaa8acd..bfd070e70 100644 --- a/lib/inventory/tests/default.nix +++ b/lib/inventory/tests/default.nix @@ -2,25 +2,31 @@ { test_inventory_empty = { # Empty inventory should return an empty module - expr = buildInventory { }; + expr = buildInventory { + inventory = { }; + directory = ./.; + }; expected = { }; }; test_inventory_role_imports = let configs = buildInventory { - services = { - borgbackup.instance_1 = { - roles.server.machines = [ "backup_server" ]; - roles.client.machines = [ - "client_1_machine" - "client_2_machine" - ]; + directory = ./.; + inventory = { + services = { + borgbackup.instance_1 = { + roles.server.machines = [ "backup_server" ]; + roles.client.machines = [ + "client_1_machine" + "client_2_machine" + ]; + }; + }; + machines = { + "backup_server" = { }; + "client_1_machine" = { }; + "client_2_machine" = { }; }; - }; - machines = { - "backup_server" = { }; - "client_1_machine" = { }; - "client_2_machine" = { }; }; }; in @@ -49,18 +55,21 @@ test_inventory_tag_resolve = let configs = buildInventory { - services = { - borgbackup.instance_1 = { - roles.client.tags = [ "backup" ]; + directory = ./.; + inventory = { + services = { + borgbackup.instance_1 = { + roles.client.tags = [ "backup" ]; + }; }; - }; - machines = { - "not_used_machine" = { }; - "client_1_machine" = { - tags = [ "backup" ]; - }; - "client_2_machine" = { - tags = [ "backup" ]; + machines = { + "not_used_machine" = { }; + "client_1_machine" = { + tags = [ "backup" ]; + }; + "client_2_machine" = { + tags = [ "backup" ]; + }; }; }; }; @@ -85,14 +94,17 @@ test_inventory_multiple_roles = let configs = buildInventory { - services = { - borgbackup.instance_1 = { - roles.client.machines = [ "machine_1" ]; - roles.server.machines = [ "machine_1" ]; + directory = ./.; + inventory = { + services = { + borgbackup.instance_1 = { + roles.client.machines = [ "machine_1" ]; + roles.server.machines = [ "machine_1" ]; + }; + }; + machines = { + "machine_1" = { }; }; - }; - machines = { - "machine_1" = { }; }; }; in @@ -112,13 +124,16 @@ test_inventory_role_doesnt_exist = let configs = buildInventory { - services = { - borgbackup.instance_1 = { - roles.roleXYZ.machines = [ "machine_1" ]; + directory = ./.; + inventory = { + services = { + borgbackup.instance_1 = { + roles.roleXYZ.machines = [ "machine_1" ]; + }; + }; + machines = { + "machine_1" = { }; }; - }; - machines = { - "machine_1" = { }; }; }; in @@ -132,15 +147,18 @@ test_inventory_tag_doesnt_exist = let configs = buildInventory { - services = { - borgbackup.instance_1 = { - roles.client.machines = [ "machine_1" ]; - roles.client.tags = [ "tagXYZ" ]; + directory = ./.; + inventory = { + services = { + borgbackup.instance_1 = { + roles.client.machines = [ "machine_1" ]; + roles.client.tags = [ "tagXYZ" ]; + }; }; - }; - machines = { - "machine_1" = { - tags = [ "tagABC" ]; + machines = { + "machine_1" = { + tags = [ "tagABC" ]; + }; }; }; };