networking: Remove options nodes and peers

This commit is contained in:
SebastianStork 2026-03-18 15:09:15 +01:00
parent 25e81ccc80
commit 253c897a5f
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
3 changed files with 12 additions and 38 deletions

View file

@ -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 = {

View file

@ -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;

View file

@ -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