2021-11-29 04:11:58 -08:00
{ config , pkgs , lib , . . . }:
{
# services.tailscale.enable = true;
networking . firewall . allowedUDPPorts = [ 60990 ] ;
age . secrets . curve-wg . file = " / e t c / n i x o s / s e c r e t s / c u r v e - w g . a g e " ;
age . secrets . curve-wg . owner = " a n i s h " ;
networking . wireguard . interfaces = {
# TODO need some kind of module here to configure curve & box from hosts or something
wg0 = {
ips = [ " 1 0 . 0 . 6 9 . 2 / 2 4 " ] ;
listenPort = 60990 ; # to match firewall allowedUDPPorts (without this wg uses random port numbers)
2022-01-04 06:27:58 -08:00
privateKeyFile = " / r u n / a g e n i x / c u r v e - w g " ;
2021-11-29 04:11:58 -08:00
peers = [
# For a client configuration, one peer entry for the server will suffice.
{
publicKey = " c 1 J 4 p 6 3 r D 3 I l s z u g M Z i k i 7 U B V 3 Y m D d q a 3 D U 4 U e j X z A I = " ;
allowedIPs = [ " 1 0 . 0 . 6 9 . 0 / 2 4 " ] ;
# Set this to the server IP and port.
2022-01-04 06:27:58 -08:00
endpoint = " 1 4 9 . 2 8 . 1 6 3 . 7 8 : 6 0 9 9 0 " ; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577
2021-11-29 04:11:58 -08:00
# Send keepalives every 25 seconds. Important to keep NAT tables alive.
persistentKeepalive = 25 ;
}
] ;
} ;
} ;
}