NixOS-Config/modules/system/devices/networking/wireguard/server/default.nix

37 lines
959 B
Nix
Raw Normal View History

2024-10-09 03:36:08 -04:00
{ outputs, ... }:
{
networking = {
nat = {
enable = true;
externalInterface = "${outputs.ips.netInt}";
internalInterfaces = [ "${outputs.ips.wgInt}" ];
};
firewall.allowedUDPPorts = [ 51820 ];
};
2024-09-06 01:18:21 -04:00
networking.wireguard = {
enable = true;
interfaces = {
"${outputs.ips.wgInt}" = {
ips = [ "${outputs.ips.wgSpan}.1/24" ];
2024-09-06 01:18:21 -04:00
listenPort = 51820;
2024-10-09 03:36:08 -04:00
privateKey = outputs.secrets.wgServerPriv;
2024-09-06 01:18:21 -04:00
peers = [
2024-09-08 10:30:01 -04:00
{ # Jimbo Pixel 9
publicKey = outputs.secrets.wgPixel9Pub;
allowedIPs = [ "${outputs.ips.wgSpan}.2/32" ];
2024-09-06 01:18:21 -04:00
}
2024-09-11 21:58:40 -04:00
{ # Oracle VM
publicKey = outputs.secrets.wgOraclePub;
allowedIPs = [ "${outputs.ips.wgSpan}.3/32" ];
2024-09-11 21:58:40 -04:00
}
{ # General Nix
publicKey = outputs.secrets.wgClientPub;
allowedIPs = [ "${outputs.ips.wgSpan}.16/28" ];
}
2024-09-06 01:18:21 -04:00
];
};
};
};
}