c5209b0d90
need to add all my stuff btw
22 lines
621 B
Nix
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 ];
|
|
};
|
|
}
|