cluster/lib: add otherNodes in services
This commit is contained in:
parent
acd4e1a09d
commit
e2da732613
2 changed files with 14 additions and 1 deletions
|
@ -1,6 +1,13 @@
|
|||
vars:
|
||||
{ name, config, lib, ... }:
|
||||
with lib;
|
||||
|
||||
let
|
||||
notSelf = x: x != vars.hostName;
|
||||
|
||||
filterGroup = builtins.filter notSelf;
|
||||
in
|
||||
|
||||
{
|
||||
options = {
|
||||
nodes = mkOption {
|
||||
|
@ -17,10 +24,16 @@ with lib;
|
|||
type = with types; attrsOf (oneOf [ str (listOf str) ]);
|
||||
default = [];
|
||||
};
|
||||
otherNodes = mkOption {
|
||||
description = "Other nodes in the group.";
|
||||
type = with types; attrsOf (listOf str);
|
||||
default = [];
|
||||
};
|
||||
nixos = mkOption {
|
||||
description = "NixOS configurations per node group.";
|
||||
type = with types; attrs;
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
config.otherNodes = builtins.mapAttrs (_: filterGroup) config.nodes;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ in
|
|||
{
|
||||
options.services = mkOption {
|
||||
description = "Cluster services.";
|
||||
type = with types; attrsOf (submodule (import ./service-module.nix ));
|
||||
type = with types; attrsOf (submodule (import ./service-module.nix config.vars));
|
||||
default = {};
|
||||
};
|
||||
config.out.injectedNixosConfig = lib.flatten (lib.mapAttrsToList (_: getServiceConfigurations) config.services);
|
||||
|
|
Loading…
Reference in a new issue