From 232faef5c02b9a5ec67aa3317f360a2e2e6126c6 Mon Sep 17 00:00:00 2001 From: Lyn Date: Thu, 14 Nov 2024 01:32:43 +0100 Subject: [PATCH] small fixes to peerlist -> endpoint generation --- hosts/network.nix | 7 ++++--- modules/services/wgautomesh.nix | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/hosts/network.nix b/hosts/network.nix index 68aaefb..c95ba26 100644 --- a/hosts/network.nix +++ b/hosts/network.nix @@ -90,8 +90,8 @@ in { type = lib.types.submodule { options = { public = lib.mkOption { - type = lib.types.nullOr lib.types.str; - default = null; + type = lib.types.str; + default = ""; description = "Public IPv4 address"; }; internal = lib.mkOption { @@ -107,7 +107,8 @@ in { type = lib.types.submodule { options = { public = lib.mkOption { - type = lib.types.nullOr lib.types.str; + type = lib.types.str; + default = ""; description = "Public IPv6 address"; }; internal = lib.mkOption { diff --git a/modules/services/wgautomesh.nix b/modules/services/wgautomesh.nix index 63936dc..e1dfd97 100644 --- a/modules/services/wgautomesh.nix +++ b/modules/services/wgautomesh.nix @@ -21,7 +21,10 @@ lib.mapAttrsToList (name: host: { pubkey = host.wg.pubkey; #if there is no public IP, make endpoint null so wgautomesh knows it unknown - endpoint = host.${version}.public; + endpoint = + if host.${version}.public == "" + then null + else "${host.${version}.public}:${toString host.wg.port}"; address = host.${version}.internal; }) filteredHosts; @@ -46,6 +49,7 @@ in { privateKeyFile = "/var/lib/wireguard-keys/private"; mtu = 1420; }; + services.wgautomesh = { enable = true; settings = { @@ -57,6 +61,9 @@ in { upnp_forward_external_port = wireguardPort; }; gossipSecretFile = gossip_secret_path; + + #DEBUG + logLevel = "trace"; }; }; }