Files
2026-07-12 11:15:42 -05:00

22 lines
621 B
Nix

{ config, lib, ... }:
let
cfg = config.workstation.networking.wireguard;
in
{
config = lib.mkIf cfg.enable {
networking.wg-quick.interfaces = lib.mapAttrs (name: iface: {
address = iface.address;
privateKeyFile = iface.privateKeyFile;
peers = map (p: {
publicKey = p.publicKey;
allowedIPs = p.allowedIPs;
endpoint = p.endpoint;
persistentKeepalive = if p.persistentKeepalive != null then p.persistentKeepalive else null;
}) iface.peers;
}) (lib.filterAttrs (_: v: v.enable) cfg.interfaces);
networking.firewall.allowedUDPPorts = [ 51820 ];
};
}