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 = { networking.wg-quick.interfaces.wireguard0 = {
privateKeyFile = config.sops.secrets."ni/wireguard/private-key".path; privateKeyFile = config.sops.secrets."ni/wireguard/private-key".path;
dns = with wireguardPeers.server; [ IPv4 IPv6 ];
address = with wireguardPeers.desktop; [ address = with wireguardPeers.desktop; [
"${IPv4}/32" "${IPv4}/24"
"${IPv6}/128" "${IPv6}/96"
]; ];
peers = [ 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; presharedKeyFile = config.sops.secrets."ni/wireguard/preshared-keys/plover".path;
allowedIPs = wireguardAllowedIPs; allowedIPs = wireguardAllowedIPs;
endpoint = "${interfaces.main'.IPv4.address}:${toString wireguardPort}"; endpoint = "${interfaces.main'.IPv4.address}:${toString wireguardPort}";

View File

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