about summary refs log tree commit diff
path: root/modules/piracy/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/piracy/default.nix26
1 files changed, 20 insertions, 6 deletions
diff --git a/modules/piracy/default.nix b/modules/piracy/default.nix
index be957f0..7682356 100644
--- a/modules/piracy/default.nix
+++ b/modules/piracy/default.nix
@@ -58,6 +58,9 @@ in
             rpcSocket = socket;
             configText =
               with config.services.rtorrent;
+              let
+                pow = x: y: lib.pow x y |> toString;
+              in
               lib.mkForce ''
                 directory.default.set = ${files}
                 session.path.set = ${dataDir}/session
@@ -72,23 +75,33 @@ in
 
                 protocol.encryption.set = allow_incoming,try_outgoing,enable_retry
 
-                pieces.memory.max.set = ${toString (lib.pow 2 11)}M
+                pieces.memory.max.set = ${pow 2 11}M
                 pieces.preload.type.set = 2
 
-                network.max_open_files.set   = ${toString (lib.pow 2 13)}
-                network.max_open_sockets.set = ${toString (lib.pow 2 13)}
+                network.max_open_files.set   = ${pow 2 16}
+                network.max_open_sockets.set = ${pow 2 15}
 
-                network.http.max_open.set = ${toString (lib.pow 2 10)}
+                network.http.max_open.set = ${pow 2 10}
 
+                # https://github.com/rakshasa/rtorrent/wiki/Performance-Tuning#peers-and-slots
+                throttle.max_downloads.global.set = 10
+                throttle.max_uploads.global.set = 1000
+                throttle.min_peers.seed.set = 99
+                throttle.max_peers.seed.set = 100
                 throttle.global_down.max_rate.set_kb = 0
-                throttle.global_up.max_rate.set_kb   = 0
+                throttle.global_up.max_rate.set_kb = 0
+
+                pieces.preload.type.set = 2
 
                 network.scgi.open_local = ${socket}
-                network.xmlrpc.size_limit.set = ${toString (lib.pow 2 17)}
+                network.xmlrpc.size_limit.set = ${pow 2 17}
 
                 encoding.add = utf8
                 system.umask.set = 0007
 
+                # https://github.com/rakshasa/rtorrent/wiki/Performance-Tuning#session-save
+                schedule2 = session_save, 1200, 43200, ((session.save))
+
                 log.open_file = "log", "/var/log/rtorrent/log"
                 log.add_output = "info", "log"
               '';
@@ -106,6 +119,7 @@ in
                 RuntimeDirectory = "rtorrent";
                 LogsDirectory = "rtorrent";
                 ReadWritePaths = [ files ];
+                LimitNOFILE = lib.pow 2 17;
               };
               after = [ "rtorrent.socket" ];
               requires = [ "rtorrent.socket" ];

Consider giving Nix/NixOS a try! <3