all: use wg-quick for wireguard

This commit is contained in:
Adithya 2024-10-25 22:59:09 +05:30
parent 8318f75fcf
commit b735c09e57
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
2 changed files with 4 additions and 4 deletions

View file

@ -1,5 +1,6 @@
_: { _: {
nodeconfig.wireguard = { nodeconfig.wireguard = {
interface-name = "Homelab";
endpoint = "165.232.180.97:51821"; endpoint = "165.232.180.97:51821";
endpoint-publickey = "NNw/iDMCTq8mpHncrecEh4UlvtINX/UUDtCJf2ToFR4="; endpoint-publickey = "NNw/iDMCTq8mpHncrecEh4UlvtINX/UUDtCJf2ToFR4=";
allowed-ips = [ allowed-ips = [

View file

@ -52,16 +52,15 @@ let cfg = config.nodeconfig; in {
config = lib.mkIf cfg.wireguard.enable { config = lib.mkIf cfg.wireguard.enable {
networking.firewall.trustedInterfaces = [ cfg.wireguard.interface-name ]; networking.firewall.trustedInterfaces = [ cfg.wireguard.interface-name ];
networking.wireguard = { networking.wg-quick = {
enable = true;
interfaces = { interfaces = {
"${cfg.wireguard.interface-name}" = { "${cfg.wireguard.interface-name}" = {
ips = cfg.wireguard.node-ips; address = cfg.wireguard.node-ips;
dns = [ "10.10.10.10" ];
listenPort = cfg.wireguard.listen-port; listenPort = cfg.wireguard.listen-port;
privateKeyFile = cfg.wireguard.pk-file; privateKeyFile = cfg.wireguard.pk-file;
peers = [ peers = [
{ {
name = "Default";
endpoint = cfg.wireguard.endpoint; endpoint = cfg.wireguard.endpoint;
publicKey = cfg.wireguard.endpoint-publickey; publicKey = cfg.wireguard.endpoint-publickey;
presharedKeyFile = cfg.wireguard.psk-file; presharedKeyFile = cfg.wireguard.psk-file;