nixos/hosts/sigma/deluge.nix

77 lines
2.3 KiB
Nix
Raw Normal View History

2024-04-22 23:59:18 +02:00
{
lib,
pkgs,
secrets,
...
}: {
# Deluge BitTorrent Client is a free and open-source, cross-platform
# BitTorrent client written in Python.
# https://www.deluge-torrent.org/
services.deluge = {
enable = true;
2024-04-24 00:05:25 +02:00
# Use the 'torrent' group to share files amongst downloaders, indexers etc.
group = "torrent";
2024-04-22 23:59:18 +02:00
web.enable = true;
2024-04-24 00:05:25 +02:00
# Config defaults:
2024-04-22 23:59:18 +02:00
# https://git.deluge-torrent.org/deluge/tree/deluge/core/preferencesmanager.py#n41
declarative = true;
config = {
2024-04-24 00:05:25 +02:00
download_location = "/srv/torrents/downloads/";
# use the dedicated network interface and port
2024-04-22 23:59:18 +02:00
listen_interface = secrets.sigma.sigma-p2p-ip-address;
outgoing_interface = "wg-sigma-p2p";
random_port = false;
listen_ports = [60881];
# no limits
max_connections_global = -1;
max_upload_slots_global = -1;
max_half_open_connections = -1;
max_connections_per_second = -1;
max_active_seeding = -1;
max_active_downloading = -1;
max_active_limit = -1;
# caching
cache_size = 65536; # 65536 x 16KiB = 1GiB
2024-04-24 00:05:25 +02:00
# enable label plugin, primarily for sonarr
2024-04-22 23:59:18 +02:00
enabled_plugins = ["Label"];
};
# authfile is required with declarative=true; allow access from webui
authFile = pkgs.writeTextFile {
name = "deluge-auth";
text = ''
localclient::10
'';
};
};
# Only allow deluged internet access through wg-sigma-p2p
systemd.services.deluged = {
serviceConfig = {
RestrictNetworkInterfaces = "lo wg-sigma-p2p";
};
};
environment.persistence."/nix/persist" = {
directories = [
2024-04-24 00:05:25 +02:00
# Deluge data directory. This is *NOT* where the downloads are saved
2024-04-22 23:59:18 +02:00
{
directory = "/var/lib/deluge";
user = "deluge";
2024-04-24 00:05:25 +02:00
group = "torrent";
mode = "0770";
}
# Since Sonarr insists on using hardlinks to manage media files, its
# media library must be on the same volume as Deluge stores its
# downloads. Therefore, Deluge will save to /srv/torrents/downloads/ and
# Sonarr will hardlink in /srv/torrents/tv/. Jellyfin reads from
# /srv/torrents/downloads/movies/ and /srv/torrents/tv/.
{
directory = "/srv/torrents";
user = "caspervk";
group = "torrent";
2024-04-22 23:59:18 +02:00
mode = "0770";
}
];
};
}