2023-03-07 15:48:46 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2022-08-13 09:09:38 +00:00
|
|
|
psCfg = config.pub-solar;
|
|
|
|
cfg = config.pub-solar.home-controller;
|
2023-03-07 15:48:46 +00:00
|
|
|
in {
|
2022-08-13 09:09:38 +00:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.wireguard-wghome.serviceConfig.Restart = "on-failure";
|
|
|
|
systemd.services.wireguard-wghome.serviceConfig.RestartSec = "5s";
|
|
|
|
|
2023-03-07 15:48:46 +00:00
|
|
|
networking.firewall.allowedUDPPorts = [51899];
|
2022-08-13 09:09:38 +00:00
|
|
|
|
|
|
|
networking.wireguard.interfaces = {
|
|
|
|
wghome = {
|
2023-03-07 15:48:46 +00:00
|
|
|
ips = [cfg.ownIp];
|
|
|
|
listenPort = 51899;
|
|
|
|
privateKeyFile = cfg.wireguardPrivateKeyFile;
|
2023-10-28 00:56:04 +00:00
|
|
|
mtu = 1400;
|
2023-03-07 15:48:46 +00:00
|
|
|
peers = [
|
|
|
|
{
|
|
|
|
# chonk
|
|
|
|
publicKey = "t1DS0y6eVzyGwomKAEWTWVsHK3xB7M/fNQ3wLgE3+B8=";
|
|
|
|
allowedIPs = ["10.0.1.0/24"];
|
|
|
|
endpoint = "vpn.gssws.de:51899";
|
|
|
|
persistentKeepalive = 25;
|
|
|
|
}
|
|
|
|
];
|
2022-08-13 09:09:38 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|