nix/nixos/hosts/framework-server/wireguard.nix

35 lines
985 B
Nix
Raw Normal View History

2023-12-01 13:25:48 +01:00
{ pkgs, config, lib, ... }: {
# Set up the secrets file:
sops.secrets."wireguard_keys/framework-server" = {
owner = "root";
sopsFile = ../../../secrets/wireguard.yaml;
};
sops.secrets."wireguard_keys/preshared_key" = {
owner = "root";
sopsFile = ../../../secrets/wireguard.yaml;
};
# Wireguard Forwarder
networking.firewall.allowPing = true;
networking.wireguard = {
enable = true;
interfaces = {
"wireguard0" = {
ips = [ "10.100.0.2/24" ];
listenPort = 51820;
privateKeyFile = "/run/secrets/wireguard_keys/framework-server";
# Testing
peers = [
2023-12-05 14:01:33 +01:00
{ # osaka-linode-01
2023-12-01 13:25:48 +01:00
publicKey = "yPZ3EmmIqCkReXf1DRTxzVaKQ2k+ifGmYJHji5nnMmE=";
presharedKeyFile = "/run/secrets/wireguard_keys/preshared_key";
persistentKeepalive = 5;
allowedIPs = [ "10.100.0.1/32" ];
endpoint = "64.176.54.57:51820";
}
];
};
};
};
}