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"; }; }; }