clean up mkMesh implementation

This commit is contained in:
Lyn 2025-01-14 21:43:47 +01:00
parent 7f00516334
commit 7424a0ec81
3 changed files with 12 additions and 8 deletions

View file

@ -24,9 +24,9 @@ with config.lyn.lib; {
# Firmware updates:
services.fwupd.enable = true;
lyn.services.wgautomesh = {
lyn.services.mkMesh = {
enable = true;
enable_upnp = true;
enable_upnp_portforward = true;
};
##1##3##3##7##

View file

@ -18,8 +18,9 @@
# network
lyn.services.wgautomesh = {
lyn.services.mkMesh = {
enable = true;
enable_lan_discovery = false;
};
networking.useDHCP = false;

View file

@ -39,11 +39,16 @@
currentHost = meshnetwork.hosts.${config.networking.hostName};
in {
opt = {
enable_upnp = lib.mkOption {
enable_upnp_portforward = lib.mkOption {
type = lib.types.bool;
description = "Whether to allow the wireguard port in the gateway using UPnP IGD. Necessary on some firewalls, might spam unnecessary debug messages on environments without IGD gateways.";
default = false;
};
enable_lan_discovery = lib.mkOption {
type = lib.types.bool;
description = "Try to discover mesh devices on the same local network.";
default = true;
};
};
config = rec {
networking.firewall = {
@ -88,13 +93,11 @@ in {
upnp_forward_external_port = config.networking.wireguard.interfaces.wg1.listenPort;
}
]
else null;
else [];
peers = buildPeerlist "IPv6" meshnetwork.hosts ++ buildPeerlist "IPv4" meshnetwork.hosts;
lan_discovery = cfg.lan_discovery;
};
gossipSecretFile = gossip_secret_path;
#DEBUG
logLevel = "trace";
};
};
}