2023-10-19 18:55:56 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
psCfg = config.pub-solar;
|
|
|
|
cfg = config.pub-solar.wireguard-client;
|
|
|
|
in {
|
|
|
|
options.pub-solar.wireguard-client = {
|
|
|
|
ownIPs = mkOption {
|
|
|
|
description = ''
|
|
|
|
Internal ips in wireguard used for cluster control-plane communication.
|
|
|
|
'';
|
|
|
|
type = types.listOf types.str;
|
|
|
|
};
|
|
|
|
|
|
|
|
wireguardPrivateKeyFile = mkOption {
|
|
|
|
description = ''
|
|
|
|
Location of private key file
|
|
|
|
'';
|
|
|
|
type = types.path;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
networking.firewall.allowedUDPPorts = [51899];
|
|
|
|
|
|
|
|
networking.wg-quick.interfaces = {
|
|
|
|
wg0 = {
|
2023-10-19 22:47:11 +00:00
|
|
|
listenPort = 51899;
|
2023-10-19 18:55:56 +00:00
|
|
|
address = cfg.ownIPs;
|
|
|
|
dns = [
|
|
|
|
"10.0.1.2"
|
|
|
|
"fd00:acab:1312:acab:2::"
|
|
|
|
];
|
|
|
|
privateKeyFile = cfg.wireguardPrivateKeyFile;
|
|
|
|
peers = [
|
|
|
|
{
|
|
|
|
# pie-server
|
|
|
|
publicKey = "8M/+y6AqbSsbK0JENkjRXqlRR56iiM/QRjGGtEM+Uj8=";
|
|
|
|
allowedIPs = [
|
2023-10-21 20:46:17 +00:00
|
|
|
"10.0.1.2/32"
|
|
|
|
"fd00:acab:1312:acab:2::/128"
|
2023-10-19 18:55:56 +00:00
|
|
|
];
|
2023-10-19 22:47:11 +00:00
|
|
|
endpoint = "[2a02:908:5b1:e3c0:3077:4e39:7763:2]:51898";
|
2023-10-19 18:55:56 +00:00
|
|
|
persistentKeepalive = 25;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|