Created
November 28, 2017 11:07
-
-
Save patrl/c9b0dfbe2d8879a5bbd3b0e74e4b679b to your computer and use it in GitHub Desktop.
NixOS wireguard configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{config, pkgs, ... }: | |
{ | |
networking.wireguard.interfaces = { | |
wg0 = { | |
ips = [ $ADDR1 ]; | |
peers = [ { | |
allowedIPs = [ $ADDR2 ]; | |
endpoint = $ADDR3; | |
publicKey = $KEY1; | |
} ]; | |
privateKey = $KEY2; | |
postSetup = [ ''${config.system.path}/bin/echo nameserver $ADDR4 | /run/current-system/sw/bin/resolvconf -a tun.wg0 -m 0 -x'' ]; | |
postShutdown = [ ''${config.system.path}/bin/resolvconf -d tun.wg0'' ]; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment