From 24a3b1a96e167b809d634878d016a729969278c0 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 27 Dec 2024 17:55:29 +0100 Subject: feat(shared): add vpn --- nixos/lib.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 nixos/lib.nix (limited to 'nixos/lib.nix') diff --git a/nixos/lib.nix b/nixos/lib.nix new file mode 100644 index 0000000..a2d8193 --- /dev/null +++ b/nixos/lib.nix @@ -0,0 +1,12 @@ +let + nixpkgs = import {}; +in +{ + joinWgNamespace = ns: cfg: + nixpkgs.lib.attrsets.recursiveUpdate cfg { + bindsTo = ["netns@${ns}.service"]; + after = ["wireguard-wg-${ns}.service"]; + unitConfig.JoinsNamespaceOf = "netns@${ns}.service"; + serviceConfig.NetworkNamespacePath = "/var/run/netns/${ns}"; + }; +} -- cgit v1.2.3