modules/wireguard: don't use wg with cache.nixos.org

This commit is contained in:
Dmitriy Pleshevskiy 2024-06-12 23:33:59 +03:00
parent 33cac6a066
commit d06e1faf3b
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.local.services.vpn.wireguard; cfg = config.local.services.vpn.wireguard;
@ -43,6 +43,13 @@ in
# Path to the private key file. # Path to the private key file.
privateKeyFile = cfg.privateKeyFile; privateKeyFile = cfg.privateKeyFile;
postUp = ''
addr=`${pkgs.iproute}/bin/ip route | ${pkgs.gawk}/bin/awk '/default/ {print $3; exit}'`
interface=`${pkgs.iproute}/bin/ip route | ${pkgs.gawk}/bin/awk '/default/ {print $5; exit}'`
# don't use wg with cache.nixos.org
${pkgs.iproute}/bin/ip route add 151.101.86.217/32 via $addr dev $interface
'';
peers = [ peers = [
# For a client configuration, one peer entry for the server will suffice. # For a client configuration, one peer entry for the server will suffice.