mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 14:19:08 +01:00
networking: Remove options nodes and peers
This commit is contained in:
parent
25e81ccc80
commit
253c897a5f
3 changed files with 12 additions and 38 deletions
|
|
@ -1,40 +1,9 @@
|
|||
{ config, lib, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
allHosts,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.custom.networking;
|
||||
in
|
||||
{
|
||||
options.custom.networking = {
|
||||
hostName = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = config.networking.hostName;
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
nodes = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.attrs;
|
||||
default =
|
||||
allHosts
|
||||
|> lib.attrValues
|
||||
|> lib.map (host: host.config.custom.networking)
|
||||
|> lib.map (
|
||||
node:
|
||||
lib.removeAttrs node [
|
||||
"nodes"
|
||||
"peers"
|
||||
]
|
||||
);
|
||||
readOnly = true;
|
||||
};
|
||||
peers = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.attrs;
|
||||
default = cfg.nodes |> lib.filter (node: node.hostName != cfg.hostName);
|
||||
readOnly = true;
|
||||
};
|
||||
options.custom.networking.hostName = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = config.networking.hostName;
|
||||
readOnly = true;
|
||||
};
|
||||
|
||||
config = {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ let
|
|||
};
|
||||
|
||||
nodeRecords =
|
||||
netCfg.nodes
|
||||
allHosts
|
||||
|> lib.attrValues
|
||||
|> lib.map (host: host.config.custom.networking)
|
||||
|> lib.map (node: {
|
||||
name = node.hostName;
|
||||
inherit (node.overlay) address;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ let
|
|||
netCfg = config.custom.networking;
|
||||
|
||||
lighthouses =
|
||||
netCfg.peers
|
||||
allHosts
|
||||
|> lib.attrValues
|
||||
|> lib.map (host: host.config.custom.networking)
|
||||
|> lib.filter (node: node.hostName != netCfg.hostName)
|
||||
|> lib.filter (peer: peer.overlay.isLighthouse)
|
||||
|> lib.map (lighthouse: lighthouse.overlay.address);
|
||||
in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue