ark/hosts/tkaronto/modules/wireguard.nix

37 lines
886 B
Nix
Raw Normal View History

2023-05-05 01:54:16 +03:00
{config, ...}: {
2023-05-08 23:09:44 +03:00
systemd.network.enable = true;
systemd.network.netdevs."wg0" = {
enable = true;
netdevConfig = {
Name = "wg0";
Kind = "wireguard";
};
wireguardConfig = {
PrivateKeyFile = config.age.secrets.wgTkarontoKey.path;
};
wireguardPeers = [
{
wireguardPeerConfig = {
PublicKey = builtins.readFile ./wgWolumondeKey.pub;
AllowedIPs = ["10.99.0.1/32"];
Endpoint = "${builtins.readFile ./wgWolumondeIp}:51820";
PersistentKeepalive = 25;
};
}
];
2023-05-05 01:54:16 +03:00
};
2023-05-08 23:09:44 +03:00
systemd.network.networks."wg0" = {
matchConfig.Name = "wg0";
networkConfig.Address = "10.99.0.2/24";
# routes = [
# {
# routeConfig = {
# Gateway = "10.99.0.1";
# Destination = "10.99.0.0/24";
# GatewayOnLink = true;
# };
# }
# ];
};
}