{ config, lib, pkgs, ... }: let cfg = config.orbekk.nycmesh; in { options = { orbekk.nycmesh = { enable = lib.mkEnableOption "Enable VPN"; listenPort = lib.mkOption { type = lib.types.port; default = 40423; description = "wireguard local port"; }; }; }; config = lib.mkIf cfg.enable { orbekk.simple-firewall.allowedUDPPorts = [ cfg.listenPort ]; networking.wireguard = { enable = true; interfaces.nycmesh = { privateKeyFile = "/opt/secret/wireguard/nycmesh.private"; ips = [ "10.70.73.50/32" ]; allowedIPsAsRoutes = false; listenPort = cfg.listenPort; peers = [ { endpoint = "wgvpn.sn1.mesh.nycmesh.net:51822"; publicKey = "04crAKqAju+ZlEXCdZGAa4OyhDe1k2CHIlshr2KoYAQ="; allowedIPs = [ "0.0.0.0/0" "::0/0" ]; } ]; }; }; }; }