aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/wireguard.nix
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2025-11-14 09:18:36 +0100
committerKarel Kočí <cynerd@email.cz>2025-11-14 09:18:36 +0100
commite44c078ebcea9d81da6d61a0ae596a3e46e9a12d (patch)
tree8870b8640cec95c389b9afc5dbbdd048f88145ef /nixos/modules/wireguard.nix
parent7606d67ed1dc56b5b5f05b6423f7a5e81db05151 (diff)
downloadnixos-personal-e44c078ebcea9d81da6d61a0ae596a3e46e9a12d.tar.gz
nixos-personal-e44c078ebcea9d81da6d61a0ae596a3e46e9a12d.tar.bz2
nixos-personal-e44c078ebcea9d81da6d61a0ae596a3e46e9a12d.zip
treewide: full update in some time
Diffstat (limited to 'nixos/modules/wireguard.nix')
-rw-r--r--nixos/modules/wireguard.nix17
1 files changed, 16 insertions, 1 deletions
diff --git a/nixos/modules/wireguard.nix b/nixos/modules/wireguard.nix
index b49eaae..4fd942c 100644
--- a/nixos/modules/wireguard.nix
+++ b/nixos/modules/wireguard.nix
@@ -6,7 +6,7 @@
}: let
inherit (lib) any all mkEnableOption mkIf mapAttrsToList optional optionals optionalAttrs filterAttrs;
inherit (config.networking) hostName;
- endpoints = ["lipwig" "spt-omnia" "adm-omnia"];
+ endpoints = ["lipwig" "spt-omnia" "adm-omnia" "zd-mox"];
is_endpoint = any (v: v == hostName) endpoints;
in {
options = {
@@ -53,6 +53,15 @@ in {
PublicKey = config.secrets.wireguardPubs.adm-omnia;
}
// (optionalAttrs (!is_endpoint) {PersistentKeepalive = 25;}))
+ ({
+ Endpoint = "zd.cynerd.cz:51820";
+ AllowedIPs = [
+ "${config.cynerd.hosts.wg.zd-mox}/32"
+ "10.8.0.0/24"
+ ];
+ PublicKey = config.secrets.wireguardPubs.zd-mox;
+ }
+ // (optionalAttrs (!is_endpoint) {PersistentKeepalive = 25;}))
]
++ (optionals is_endpoint (mapAttrsToList (n: v: {
AllowedIPs = "${config.cynerd.hosts.wg."${n}"}/32";
@@ -77,6 +86,12 @@ in {
Gateway = config.cynerd.hosts.wg.adm-omnia;
Destination = "10.8.3.0/24";
Metric = 2048;
+ })
+ ++ (optional (hostName != "zd-mox") {
+ # ZD network
+ Gateway = config.cynerd.hosts.wg.zd-mox;
+ Destination = "10.8.0.0/24";
+ Metric = 2048;
});
};
};