summaryrefslogtreecommitdiff
path: root/nixos/lib.nix
blob: a2d8193758826033b611007eb2881a792a46a2b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
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}";
  };
}