50 lines
1.2 KiB
Nix
50 lines
1.2 KiB
Nix
|
{
|
||
|
lib,
|
||
|
config,
|
||
|
...
|
||
|
}: let
|
||
|
cfg = config.pub-solar.wireguard.momo;
|
||
|
in {
|
||
|
options.pub-solar.wireguard.momo = {
|
||
|
ownIPs = lib.mkOption {
|
||
|
description = "Internal ips in wireguard used for cluster control-plane communication.";
|
||
|
type = lib.types.listOf lib.types.str;
|
||
|
default = [];
|
||
|
};
|
||
|
|
||
|
privateKeyFile = lib.mkOption {
|
||
|
description = "Location of private key file";
|
||
|
type = lib.types.path;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = lib.mkIf (lib.length cfg.ownIPs != 0) {
|
||
|
networking.firewall.allowedUDPPorts = [51823];
|
||
|
|
||
|
systemd.network.wait-online.ignoredInterfaces = ["wg-momo"];
|
||
|
|
||
|
systemd.services.wireguard-wg-momo = import ./service-override.nix lib;
|
||
|
|
||
|
networking.wireguard.interfaces = {
|
||
|
wg-momo = {
|
||
|
listenPort = 51823;
|
||
|
mtu = 1300;
|
||
|
ips = cfg.ownIPs;
|
||
|
privateKeyFile = cfg.privateKeyFile;
|
||
|
peers = [
|
||
|
{
|
||
|
endpoint = "pioneer.momo.koeln:51820";
|
||
|
publicKey = "W9Vn2yv+AZjOD7sqKp4DyMbIz5N++Vjlr+6J3BnXj3o=";
|
||
|
allowedIPs = [
|
||
|
"10.30.30.1/32"
|
||
|
"fd00:3030:3030:3030:3030:1::/96"
|
||
|
];
|
||
|
persistentKeepalive = 15;
|
||
|
dynamicEndpointRefreshSeconds = 30;
|
||
|
}
|
||
|
];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|