diff options
author | Martin Fischer <martin@push-f.com> | 2024-12-27 17:55:29 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2024-12-29 08:52:42 +0100 |
commit | 24a3b1a96e167b809d634878d016a729969278c0 (patch) | |
tree | dd8a40c3e8e0b453d0262626e9f79d95ea20aef5 /nixos/lib.nix | |
parent | 813cc3c8d51f21b37b8eb2c5ed6abf0306a7ab0d (diff) |
feat(shared): add vpn
Diffstat (limited to 'nixos/lib.nix')
-rw-r--r-- | nixos/lib.nix | 12 |
1 files changed, 12 insertions, 0 deletions
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 <nixpkgs> {}; +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}"; + }; +} |