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}"; }; }