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, ... }:
|
{ name, config, lib, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
notSelf = x: x != vars.hostName;
|
||||||
|
|
||||||
|
filterGroup = builtins.filter notSelf;
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
nodes = mkOption {
|
nodes = mkOption {
|
||||||
|
@ -17,10 +24,16 @@ with lib;
|
||||||
type = with types; attrsOf (oneOf [ str (listOf str) ]);
|
type = with types; attrsOf (oneOf [ str (listOf str) ]);
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
|
otherNodes = mkOption {
|
||||||
|
description = "Other nodes in the group.";
|
||||||
|
type = with types; attrsOf (listOf str);
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
nixos = mkOption {
|
nixos = mkOption {
|
||||||
description = "NixOS configurations per node group.";
|
description = "NixOS configurations per node group.";
|
||||||
type = with types; attrs;
|
type = with types; attrs;
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
config.otherNodes = builtins.mapAttrs (_: filterGroup) config.nodes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ in
|
||||||
{
|
{
|
||||||
options.services = mkOption {
|
options.services = mkOption {
|
||||||
description = "Cluster services.";
|
description = "Cluster services.";
|
||||||
type = with types; attrsOf (submodule (import ./service-module.nix ));
|
type = with types; attrsOf (submodule (import ./service-module.nix config.vars));
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
config.out.injectedNixosConfig = lib.flatten (lib.mapAttrsToList (_: getServiceConfigurations) config.services);
|
config.out.injectedNixosConfig = lib.flatten (lib.mapAttrsToList (_: getServiceConfigurations) config.services);
|
||||||
|
|
Loading…
Reference in a new issue