Rtorrent: Difference between revisions

From NixOS Wiki
Makefu (talk | contribs)
initial creation with sample code for rtorrent + flood
 
Makefu (talk | contribs)
m add note about how to use and import the config
Line 2: Line 2:


=== Integration with flood-js via UNIX sockets ===
=== Integration with flood-js via UNIX sockets ===
rtorrent can open a socket which other software can use to interface with. No unprotected RPC socket of rtorrent is required with this setup and it therefore provides a higher security standard<syntaxhighlight lang="nix">
rtorrent can open a socket which other software can use to interface with. No unprotected RPC socket of rtorrent is required with this setup and it therefore provides a higher security standard.
 
<syntaxhighlight lang="nix">
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, ... }:


Line 16: Line 18:
     openFirewall = true;
     openFirewall = true;
   };
   };
   services.flood = {
   services.flood = {
     enable = true;
     enable = true;
Line 26: Line 29:
   systemd.services.flood.serviceConfig.SupplementaryGroups = [ config.services.rtorrent.group ];
   systemd.services.flood.serviceConfig.SupplementaryGroups = [ config.services.rtorrent.group ];
}
}
</syntaxhighlight>
</syntaxhighlight>Sample configuration is to be put into '''rtorrent.nix''' and imported in your '''configuration.nix''' via:
{
  imports = [ ./rtorrent.nix ];
}

Revision as of 23:51, 30 December 2024

rtorrent is a bittorrent client. This article discusses integrations of rtorrent with other graphical interfaces such as flood.

Integration with flood-js via UNIX sockets

rtorrent can open a socket which other software can use to interface with. No unprotected RPC socket of rtorrent is required with this setup and it therefore provides a higher security standard.

{ config, lib, pkgs, ... }:

let
  peer-port = 51412;
  web-port = 8112;
in {
  
  services.rtorrent = {
    enable = true;
    port = peer-port;
    package = pkgs.jesec-rtorrent; # currently (2024-12-30) rtorrent 0.15.0 in nixpkgs unstable is incompatible with flood, this is why a fork is used
    openFirewall = true;
  };

  services.flood = {
    enable = true;
    port = web-port;
    openFirewall = true;
    extraArgs = ["--rtsocket=${config.services.rtorrent.rpcSocket}"];
  };
  # allow access to the socket by putting it in the same group as rtorrent service
  # the socket will have g+w permissions
  systemd.services.flood.serviceConfig.SupplementaryGroups = [ config.services.rtorrent.group ];
}

Sample configuration is to be put into rtorrent.nix and imported in your configuration.nix via:

{
  imports = [ ./rtorrent.nix ];
}