Deluge: Difference between revisions

Fschn90 (talk | contribs)
Created page with "is a BitTorrent client. === Basic Nix Configuration === <blockquote>  services.deluge = {    enable = true;    web.enable = true;   };</blockquote>The web UI is then accessible on http://localhost:8112. === How to set up deluge in a separate network namespace with only a wireguard vpn interface: === First, creating network namespace with wireguard vpn interface based on this [tutorual](<nowiki>https://discourse.nixos.org/t/setting-up-wireguard-in-a-network-n..."
 
Fschn90 (talk | contribs)
m formatting
Line 1: Line 1:
is a BitTorrent client.
is a BitTorrent client.


=== Basic Nix Configuration ===
== Basic Nix Configuration ==
<blockquote>  services.deluge = {
<syntaxhighlight lang="nix">
  services.deluge = {


   enable = true;
   enable = true;
Line 8: Line 9:
   web.enable = true;
   web.enable = true;


  };</blockquote>The web UI is then accessible on http://localhost:8112.
  };
 
</syntaxhighlight>The web UI is then accessible on http://localhost:8112.
=== How to set up deluge in a separate network namespace with only a wireguard vpn interface: ===
 
 
First, creating network namespace with wireguard vpn interface based on this [tutorual](<nowiki>https://discourse.nixos.org/t/setting-up-wireguard-in-a-network-namespace-for-selectively-routing-traffic-through-vpn/10252/8</nowiki>):


== How to set up Deluge in a separate network namespace with only a wireguard vpn interface: ==


```nix


First, creating a network namespace with wireguard vpn interface based on this [https://discourse.nixos.org/t/setting-up-wireguard-in-a-network-namespace-for-selectively-routing-traffic-through-vpn/10252/8 tutorial]:<syntaxhighlight lang="nix">
  # creating network namespace
  # creating network namespace


Line 59: Line 57:
     RemainAfterExit = true;
     RemainAfterExit = true;


     ExecStart = with pkgs; writers.writeBash "wg-up" <nowiki>''</nowiki>
     ExecStart = with pkgs; writers.writeBash "wg-up" ''


       see -e
       see -e
Line 85: Line 83:
       # ${iproute}/bin/ip -n wg -6 route add default dev wg0
       # ${iproute}/bin/ip -n wg -6 route add default dev wg0


     <nowiki>''</nowiki>;
     '';


     ExecStop = with pkgs; writers.writeBash "wg-down" <nowiki>''</nowiki>
     ExecStop = with pkgs; writers.writeBash "wg-down" ''


       ${iproute2}/bin/ip -n wg route del default dev wg0
       ${iproute2}/bin/ip -n wg route del default dev wg0
Line 95: Line 93:
       ${iproute2}/bin/ip -n wg link del wg0
       ${iproute2}/bin/ip -n wg link del wg0


     <nowiki>''</nowiki>;
     '';


   };
   };


  };
  };
 
</syntaxhighlight>Second, binding deluged to newly created network namespace and enabling connectivity of delugeweb (in root namespace) to delguded in seperate network namespace, based on this [https://github.com/existentialtype/deluge-namespaced-wireguard tutorial]:<syntaxhighlight lang="nix">
```
# binding deluged to network namespace
 
 
Second, binding deluged to newly created network namespace and enabling connectivity of delugeweb (in root namespace) to delguded in seperate network namespace, based on this [tutorial](<nowiki>https://github.com/existentialtype/deluge-namespaced-wireguard</nowiki>):
 
 
```nix
 
  # binding deluged to network namespace


  systemd.services.deluged.bindsTo = [ "netns@wg.service" ];
  systemd.services.deluged.bindsTo = [ "netns@wg.service" ];
Line 116: Line 106:


  systemd.services.deluged.serviceConfig.NetworkNamespacePath = [ "/var/run/netns/wg" ];
  systemd.services.deluged.serviceConfig.NetworkNamespacePath = [ "/var/run/netns/wg" ];


  # allowing delugeweb to access deluged in network namespace, a socket is necesarry
  # allowing delugeweb to access deluged in network namespace, a socket is necesarry
Line 158: Line 149:


  };
  };
 
</syntaxhighlight>
```