diff options
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}"; + }; +} |