2024-09-06 01:18:21 -04:00
|
|
|
{outputs, ...}: let
|
|
|
|
ips = import ../modules/ips.nix;
|
|
|
|
in {
|
2024-09-10 21:39:12 -04:00
|
|
|
# Enable NAT
|
2024-09-07 00:38:19 -04:00
|
|
|
networking = {
|
|
|
|
nat = {
|
|
|
|
enable = true;
|
|
|
|
externalInterface = "${ips.netInt}";
|
2024-09-12 01:31:59 -04:00
|
|
|
internalInterfaces = [ "${ips.wgInt}" ];
|
2024-09-07 00:38:19 -04:00
|
|
|
};
|
|
|
|
firewall.allowedUDPPorts = [ 51820 ];
|
|
|
|
};
|
2024-09-06 01:18:21 -04:00
|
|
|
|
|
|
|
networking.wireguard = {
|
|
|
|
enable = true;
|
|
|
|
interfaces = {
|
2024-09-23 13:49:48 -04:00
|
|
|
"${ips.wgInt}" = {
|
2024-09-12 01:31:59 -04:00
|
|
|
ips = [ "${ips.wgSpan}.1/24" ];
|
2024-09-06 01:18:21 -04:00
|
|
|
listenPort = 51820;
|
2024-09-23 13:49:48 -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
|
2024-09-23 13:49:48 -04:00
|
|
|
publicKey = outputs.secrets.wgPixel9Pub;
|
2024-09-12 01:31:59 -04:00
|
|
|
allowedIPs = [ "${ips.wgSpan}.2/32" ];
|
2024-09-06 01:18:21 -04:00
|
|
|
}
|
2024-09-11 21:58:40 -04:00
|
|
|
{ # Oracle VM
|
2024-09-23 13:49:48 -04:00
|
|
|
publicKey = outputs.secrets.wgOraclePub;
|
2024-09-12 01:31:59 -04:00
|
|
|
allowedIPs = [ "${ips.wgSpan}.3/32" ];
|
2024-09-11 21:58:40 -04:00
|
|
|
}
|
2024-09-23 13:49:48 -04:00
|
|
|
{ # General Nix
|
|
|
|
publicKey = outputs.secrets.wgClientPub;
|
|
|
|
allowedIPs = [ "${ips.wgSpan}.16/28" ];
|
|
|
|
}
|
2024-09-06 01:18:21 -04:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|