wireguard: remove usage of deprecated attributes

This commit is contained in:
Charlotte Van Petegem 2024-06-03 21:10:53 +02:00
parent f61e33b086
commit c567e7daf6
No known key found for this signature in database
GPG key ID: 019E764B7184435A

View file

@ -95,25 +95,21 @@ in
if config.chvp.base.network.wireguard.server then if config.chvp.base.network.wireguard.server then
(builtins.map (builtins.map
(name: { (name: {
wireguardPeerConfig = { PublicKey = data.${name}.pubkey;
PublicKey = data.${name}.pubkey; AllowedIPs = "${data.${name}.ip}/32";
AllowedIPs = "${data.${name}.ip}/32"; PresharedKeyFile = pskFile;
PresharedKeyFile = pskFile;
};
}) })
(builtins.filter (name: name != config.networking.hostName) (builtins.attrNames data))) (builtins.filter (name: name != config.networking.hostName) (builtins.attrNames data)))
else else
([{ ([{
wireguardPeerConfig = { PublicKey = data.lasting-integrity.pubkey;
PublicKey = data.lasting-integrity.pubkey; AllowedIPs = subnet;
AllowedIPs = subnet; Endpoint =
Endpoint = if config.chvp.base.network.wireguard.onCorporate
if config.chvp.base.network.wireguard.onCorporate then "127.0.0.1:51820"
then "127.0.0.1:51820" else "lasting-integrity.vanpetegem.me:51820";
else "lasting-integrity.vanpetegem.me:51820"; PresharedKeyFile = pskFile;
PresharedKeyFile = pskFile; PersistentKeepalive = 25;
PersistentKeepalive = 25;
};
}]); }]);
}; };
networks.wg0 = { networks.wg0 = {
@ -123,8 +119,7 @@ in
domains = [ "internal" ]; domains = [ "internal" ];
dns = [ data.lasting-integrity.ip ]; dns = [ data.lasting-integrity.ip ];
linkConfig.MTUBytes = "1342"; linkConfig.MTUBytes = "1342";
routes = [{ routes = [(
routeConfig =
if config.chvp.base.network.wireguard.server then { if config.chvp.base.network.wireguard.server then {
Gateway = "${data.${config.networking.hostName}.ip}"; Gateway = "${data.${config.networking.hostName}.ip}";
Destination = subnet; Destination = subnet;
@ -132,8 +127,8 @@ in
Gateway = "${data.lasting-integrity.ip}"; Gateway = "${data.lasting-integrity.ip}";
Destination = subnet; Destination = subnet;
GatewayOnLink = true; GatewayOnLink = true;
}; }
}]; )];
}; };
}; };
services = { services = {