Configuring only torrent traffic to only go through openvpn

So far I’ve configured a container to run transmission service and openvpn service:

  containers.downloads = { config = 
    { config, pkgs, ... }:
    {
      services.openvpn.servers = {
        nordvpn = { 
          config = '' config /root/default.ovpn ''; 
          autoStart = true;
        };
      };
      # How do I configure all traffic from this service to go through the vpn above?
      services.transmission.enable = true;
    };

    enableTun = true;
    autoStart = true;
  };

I can’t figure out how to get the transmission traffic to go through the vpn only, if the vpn is down I want transmission to be down as well. I figure there is a way to do this using user permissions and having the transmission service run as a specific user, but I’m not sure where to find an example for that, and my networking configuration skills aren’t polished enough to take anything more than a rough pass.

The fact that it is in a container is not inherently special, but I figured the isolation would make it easier to have the vpn running without forcing other user traffic through it.

There may be other ways to do it, but from what I’ve seen Transmission supports a flag to bind it to an IP: https://www.reddit.com/r/linux/comments/27ysg9/help_forcing_transmissiondaemon_over_vpn/ci6ijuv/

Thanks for the reply! To follow up I managed to get this working by following a per-user-vpn I found on Github.