hosts: update Wireguard setup

This commit is contained in:
Gabriel Arazas 2023-02-06 16:08:08 +08:00
parent 213ecb8598
commit c8b55c278a
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 7 additions and 5 deletions

View File

@ -201,14 +201,16 @@ in
networking.wg-quick.interfaces.wireguard0 = {
privateKeyFile = config.sops.secrets."ni/wireguard/private-key".path;
dns = with wireguardPeers.server; [ IPv4 IPv6 ];
address = with wireguardPeers.desktop; [
"${IPv4}/32"
"${IPv6}/128"
"${IPv4}/24"
"${IPv6}/96"
];
peers = [
{
publicKey = lib.readFile ../plover/files/wireguard/wireguard-public-key-plover;
publicKey = lib.removeSuffix "\n" (lib.readFile ../plover/files/wireguard/wireguard-public-key-plover);
presharedKeyFile = config.sops.secrets."ni/wireguard/preshared-keys/plover".path;
allowedIPs = wireguardAllowedIPs;
endpoint = "${interfaces.main'.IPv4.address}:${toString wireguardPort}";

View File

@ -9,8 +9,8 @@ let
wireguardIFName = "wireguard0";
desktopPeerAddresses = with wireguardPeers.desktop; [ "${IPv4}/32" "${IPv6}/128" ];
phonePeerAddresses = with wireguardPeers.phone; [ "${IPv4}/32" "${IPv6}/128" ];
desktopPeerAddresses = with wireguardPeers.desktop; [ "${IPv4}/24" "${IPv6}/96" ];
phonePeerAddresses = with wireguardPeers.phone; [ "${IPv4}/24" "${IPv6}/96" ];
in
{
environment.systemPackages = [ pkgs.wireguard-tools ];