mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 15:29:07 +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,
|
options.custom.networking.hostName = lib.mkOption {
|
||||||
lib,
|
type = lib.types.nonEmptyStr;
|
||||||
allHosts,
|
default = config.networking.hostName;
|
||||||
...
|
readOnly = true;
|
||||||
}:
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
nodeRecords =
|
nodeRecords =
|
||||||
netCfg.nodes
|
allHosts
|
||||||
|
|> lib.attrValues
|
||||||
|
|> lib.map (host: host.config.custom.networking)
|
||||||
|> lib.map (node: {
|
|> lib.map (node: {
|
||||||
name = node.hostName;
|
name = node.hostName;
|
||||||
inherit (node.overlay) address;
|
inherit (node.overlay) address;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ let
|
||||||
netCfg = config.custom.networking;
|
netCfg = config.custom.networking;
|
||||||
|
|
||||||
lighthouses =
|
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.filter (peer: peer.overlay.isLighthouse)
|
||||||
|> lib.map (lighthouse: lighthouse.overlay.address);
|
|> lib.map (lighthouse: lighthouse.overlay.address);
|
||||||
in
|
in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue