NixOS-Config/modules/system/devices/networking/wireguard/client/default.nix

31 lines
792 B
Nix
Raw Normal View History

2024-11-24 20:02:09 -05:00
{ lib, config, ... }:
{
options.system.wireguard.client.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable the wireguard client";
};
config = lib.mkIf config.system.wireguard.client.enable {
networking = {
firewall = {
allowedUDPPorts = [ 51820 ];
trustedInterfaces = [ "wgc" ];
};
wireguard.interfaces.wgc = {
listenPort = 51820;
privateKey = config.secrets.wgClientPriv;
peers = [
{ # Cyberspark Server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "10.100.0.0/24" ];
endpoint = "sv.${config.domains.jim1}:51820";
persistentKeepalive = 25;
}
];
};
};
};
}