From b6e5604c0281b8cf8ea26684dfdd0b3c4c2a47a0 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sun, 8 Oct 2023 15:35:56 +0530 Subject: [PATCH] refactor wireguard configs --- hosts/skipper/wireguard.nix | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/hosts/skipper/wireguard.nix b/hosts/skipper/wireguard.nix index cac32ad..c37c3a7 100644 --- a/hosts/skipper/wireguard.nix +++ b/hosts/skipper/wireguard.nix @@ -1,16 +1,19 @@ -{secrets, ...}: { - networking.wireguard = let - inherit (secrets.wireguard_config) server; - inherit (secrets.wireguard_config) peers; - in { +{ + config, + secrets, + ... +}: let + inherit (secrets.wireguard_config) peers Proxy; +in { + networking.wireguard = { enable = true; interfaces = { wg0 = { - inherit (peers."1") ips; + inherit (peers."${config.networking.hostName}") ips; privateKeyFile = "/etc/wireguard/private.key"; generatePrivateKeyFile = true; peers = [ - server + Proxy ]; }; };