qbitorrent has replaced flood and rtorrent

This commit is contained in:
Haak Saxberg 2023-11-06 20:52:58 -08:00
parent 495441670d
commit 0f74c957a1
6 changed files with 9 additions and 171 deletions

View file

@ -1,39 +0,0 @@
{ pkgs, ... }:
{
networking.firewall = {
allowedTCPPorts = [
#nginx
80
443
];
};
services.nginx = {
enable = true;
virtualHosts."torrents" = {
locations."/" = {
proxyPass = "http://localhost:3000";
};
};
};
users.users.flood.group = "flood";
users.extraUsers.flood = {
isNormalUser = true;
extraGroups = [ "rtorrent" "users" ];
};
systemd.services = {
flood = {
enable = true;
serviceConfig = {
User = "flood";
WorkingDirectory = "/home/flood";
ExecStart = "${pkgs.flood}/bin/flood";
Restart = "on-failure";
};
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "rtorrent.service" ];
};
};
}

View file

@ -2,6 +2,13 @@
{
environment.systemPackages = with pkgs; [ qbittorrent-nox ];
users.groups.qbittorrent = { };
users.users.qbittorrent.group = "qbittorrent";
users.extraUsers.qbittorrent = {
isNormalUser = true;
extraGroups = [ "users" "multimedia" ];
};
systemd = {
packages = [ pkgs.qbittorrent-nox ];
@ -9,7 +16,7 @@
enable = true;
serviceConfig = {
Type = "simple";
User = "rtorrent";
User = "qbittorrent";
ExecStart = "${pkgs.qbittorrent-nox}/bin/qbittorrent-nox";
};
wantedBy = [ "multi-user.target" ];

View file

@ -1,38 +0,0 @@
{ pkgs, finalDir, downloadDir, watchDir }:
let
# this needs to be configured in mullvad's settings
dhtPort = 55358;
rtorrentPort = 54945;
in
{
environment.systemPackages = with pkgs; [ rtorrent ];
users.extraUsers.rtorrent.extraGroups = [ "users" ];
services.rtorrent = {
enable = true;
port = rtorrentPort;
openFirewall = true;
downloadDir = downloadDir;
# flood needs to be able to access the datadir
dataDir = downloadDir;
configText =
builtins.readFile (pkgs.substituteAll {
src = ./rtorrent.rc;
watchDir = watchDir;
finalDir = finalDir;
dhtPort = builtins.toString dhtPort;
});
};
networking.firewall = {
allowedTCPPorts = [
dhtPort
];
allowedUDPPorts = [
dhtPort
rtorrentPort
];
};
}

View file

@ -1,85 +0,0 @@
# Set an interface with IPv4 address to bind to:
method.insert = cfg.interface.bind, string|const|private, (cat,"wg0")
# Get IPv4 address of a given interface
method.insert = get_interface_ipv4_address, simple|private, "execute.capture=bash,-c,\"$cat=\\\"echo -n \$(ip -o -4 addr show \\\",$argument.0=,\\\" | grep -Po 'inet \\\\\\\\\\K[\\\\\\\\\\d.]+')\\\"\""
# The IP address the listening socket and outgoing connections is bound to. (bind)
schedule2 = set_bind_address, 0, 0, \
"branch=((cfg.interface.bind)), \
((network.bind_address.set,(get_interface_ipv4_address,(cfg.interface.bind))))"
# Port range to use for listening. (port_range)
network.port_range.set = @dhtPort@-@dhtPort@
# Enable/disable peer exchange for torrents that aren't marked private. Disabled by default. (peer_exchange)
protocol.pex.set = 1
# Set whether the client should try to connect to UDP trackers (It can cause various problems if it's enabled, if you experience any with this option enabled then disable it.)
trackers.use_udp.set = 1
# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off".
# For DHT to work, a session directory must be defined.
dht.mode.set = auto
dht.port.set = @dhtPort@
throttle.max_uploads.set = 100
throttle.max_uploads.global.set = 250
throttle.min_peers.normal.set = 1
throttle.max_peers.normal.set = 1024
throttle.min_peers.seed.set = 1
throttle.max_peers.seed.set = 1024
trackers.numwant.set = 80
# Adding public DHT servers for easy bootstrapping
schedule2 = dht_node_1, 5, 0, "dht.add_node=router.utorrent.com:6881"
schedule2 = dht_node_2, 5, 0, "dht.add_node=dht.transmissionbt.com:6881"
schedule2 = dht_node_3, 5, 0, "dht.add_node=router.bitcomet.com:6881"
schedule2 = dht_node_4, 5, 0, "dht.add_node=dht.aelitis.com:6881"
# Enable the default ratio group.
ratio.enable=
# Change the limits, the defaults should be sufficient.
ratio.min.set = 100
ratio.max.set = 300
ratio.upload.set = 20M
# To ensure world-readable results
system.umask.set = 0000
# Changing the command triggered when the ratio is reached.
# (the default is "d.try_close= ; d.ignore_commands.set=1")
method.set = group.seeding.ratio.command, "d.close= ; d.erase="
# Add new method to get finished dir (called get_finished_dir)
method.insert = d.get_finished_dir,simple,"cat=@finalDir@/,$d.custom1="
# Bind event "torrent has finished" to action "move to new directory based on label"
# method.set_key = event.download.finished,move_complete
# Modifies the event.download.finished event to also have a new “key”
# called “move_complete”. From what I understand, rTorrent executes all
# “keys” in an event whenever that event is fired. The
# event.download.finished event fires whenever a torrent has finished
# downloading. The stuff within the quotation marks is the new keys
# commands. Each command is separated by a semicolon (;).
# d.directory.set=$d.get_finished_dir=;
# d.directory.set sets the directory of the torrent in rTorrents own
# information. It does not move the torrent, just means rTorrent will
# look in that directory from now on. $d.get_finished_dir just runs the
# get_finished_dir method preciously inserted; constructing a path name
# by combining [folder]/finished/ with whatever label was applied
# ($d.custom1 contains the label).
# execute=mkdir,-p,$d.get_finished_dir=;
# Gets the same path name and makes sure the directory actually exists.
# Mkdir is the standard *nix command for creating directories. -p means
# creating parent directories if needed and not complaining if directory
# already exists.
# execute=mv,-u,$d.base_path=,$d.get_finished_dir=
# Uses the same “execute” functionality as above to run the standard *nix
# mv command to move the torrents files (whose location is stored in
# d.base_path) to, once again, the directory whose name was constructed
# by the get_finished_dir method.
method.set_key = event.download.finished,move_complete,"d.directory.set=$d.get_finished_dir=;execute=mkdir,-p,$d.get_finished_dir=;execute=mv,-u,$d.base_path=,$d.get_finished_dir="