NixOS-Config/system/desktop/wireguard.nix

24 lines
604 B
Nix
Raw Normal View History

{outputs, ...}: let
ips = import ../modules/ips.nix;
in {
networking.firewall = {
allowedUDPPorts = [ 51820 ];
};
networking.wireguard.interfaces = {
"${ips.wgInt}" = {
# Define IP of client in per device config
listenPort = 51820;
privateKey = outputs.secrets.wgClientPriv;
peers = [
{ # 0.0.0.0 makes wg act like a traditional VPN
publicKey = outputs.secrets.wgServerPub;
allowedIPs = [ "0.0.0.0/0" ];
endpoint = "mc.${outputs.secrets.jimDomain}:51820";
persistentKeepalive = 25;
}
];
};
};
}