Inventory: fix roles config

This commit is contained in:
Johannes Kirschbauer
2024-07-15 15:59:59 +02:00
parent 8e7a34af0d
commit 018f18a93e
2 changed files with 12 additions and 8 deletions

View File

@@ -19,7 +19,10 @@
}, },
"roles": { "roles": {
"default": { "default": {
"machines": ["minimal-inventory-machine"] "machines": ["minimal-inventory-machine"],
"config": {
"packages": ["vim"]
}
} }
}, },
"machines": { "machines": {

View File

@@ -85,8 +85,7 @@ let
) inverseRoles.${machineName} or [ ]; ) inverseRoles.${machineName} or [ ];
roleServiceConfigs = builtins.map ( roleServiceConfigs = builtins.map (
role: role: serviceConfig.roles.${role}.config or { }
serviceConfig.roles.${role}.config or { }
) inverseRoles.${machineName} or [ ]; ) inverseRoles.${machineName} or [ ];
in in
if isInService then if isInService then
@@ -94,11 +93,13 @@ let
++ [ ++ [
{ {
imports = [ clan-core.clanModules.${moduleName} ] ++ roleModules; imports = [ clan-core.clanModules.${moduleName} ] ++ roleModules;
config.clan.${moduleName} = lib.mkMerge [ config.clan.${moduleName} = lib.mkMerge (
globalConfig [
machineServiceConfig globalConfig
roleServiceConfigs machineServiceConfig
]; ]
++ roleServiceConfigs
);
} }
{ {
config.clan.inventory.services.${moduleName}.${instanceName} = { config.clan.inventory.services.${moduleName}.${instanceName} = {