From 4e249f3a3baa70842c23bf425a6155be3841b416 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sun, 8 Oct 2023 15:36:04 +0530 Subject: [PATCH] setup wireguard on rico2 --- hosts/rico2/network.nix | 1 + hosts/rico2/wireguard.nix | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 hosts/rico2/wireguard.nix diff --git a/hosts/rico2/network.nix b/hosts/rico2/network.nix index 6767bbe..960ada2 100644 --- a/hosts/rico2/network.nix +++ b/hosts/rico2/network.nix @@ -1,4 +1,5 @@ {lib, ...}: { + imports = [./wireguard.nix]; networking = { hostName = "Rico2"; useDHCP = lib.mkDefault false; diff --git a/hosts/rico2/wireguard.nix b/hosts/rico2/wireguard.nix new file mode 100644 index 0000000..d814da6 --- /dev/null +++ b/hosts/rico2/wireguard.nix @@ -0,0 +1,22 @@ +{ + config, + secrets, + ... +}: let + inherit (secrets.wireguard_config) peers Proxy Skipper; +in { + networking.wireguard = { + enable = true; + interfaces = { + wg0 = { + inherit (peers."${config.networking.hostName}") ips; + privateKeyFile = "/etc/wireguard/private.key"; + generatePrivateKeyFile = true; + peers = [ + Proxy + Skipper + ]; + }; + }; + }; +}