Skip to content

Instantly share code, notes, and snippets.

@patrl
Created November 28, 2017 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrl/c9b0dfbe2d8879a5bbd3b0e74e4b679b to your computer and use it in GitHub Desktop.
Save patrl/c9b0dfbe2d8879a5bbd3b0e74e4b679b to your computer and use it in GitHub Desktop.
NixOS wireguard configuration
{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