diff --git a/modules/nixos/networking/default.nix b/modules/nixos/networking/default.nix index 653e790..b3e2c4f 100644 --- a/modules/nixos/networking/default.nix +++ b/modules/nixos/networking/default.nix @@ -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 = { diff --git a/modules/nixos/services/nameservers/private.nix b/modules/nixos/services/nameservers/private.nix index e790be2..85c8d3f 100644 --- a/modules/nixos/services/nameservers/private.nix +++ b/modules/nixos/services/nameservers/private.nix @@ -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; diff --git a/modules/nixos/services/nebula/default.nix b/modules/nixos/services/nebula/default.nix index 7b96f61..41d2bc4 100644 --- a/modules/nixos/services/nebula/default.nix +++ b/modules/nixos/services/nebula/default.nix @@ -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