2023-05-03 21:20:51 +02:00
|
|
|
{ lib, pkgs, config, ... }:
|
|
|
|
let
|
|
|
|
uiPort = 9099;
|
2023-05-04 19:35:15 +02:00
|
|
|
announceIp = "10.23.42.28";
|
|
|
|
peerPort = 51433;
|
2023-05-03 21:20:51 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
|
2023-05-04 10:12:52 +02:00
|
|
|
containers.sync-torrent = {
|
2023-05-03 21:20:51 +02:00
|
|
|
|
|
|
|
# mount host folders
|
|
|
|
bindMounts = {
|
|
|
|
media = {
|
|
|
|
hostPath = "/media";
|
|
|
|
mountPoint = "/media"; # must be here otherwise transmission can't see the folder
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
lib = {
|
2023-05-04 10:12:52 +02:00
|
|
|
hostPath = "/srv/sync-torrent";
|
2023-05-03 21:20:51 +02:00
|
|
|
mountPoint = "/var/lib/transmission";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
autoStart = true;
|
|
|
|
|
|
|
|
config = { config, pkgs, lib, ... }: {
|
|
|
|
|
|
|
|
system.stateVersion = "22.11";
|
|
|
|
services.journald.extraConfig = "SystemMaxUse=1G";
|
|
|
|
|
|
|
|
services.transmission = {
|
|
|
|
enable = true;
|
2023-05-04 20:59:26 +02:00
|
|
|
|
2023-05-03 21:20:51 +02:00
|
|
|
settings = {
|
|
|
|
download-dir = "/media";
|
2023-05-04 10:12:52 +02:00
|
|
|
incomplete-dir = "/var/lib/transmission/incomplete"; # todo put this somewhere with frequent snapshots but low keep.
|
2023-05-03 21:20:51 +02:00
|
|
|
incomplete-dir-enabled = true;
|
|
|
|
message-level = 1;
|
|
|
|
umask = 2;
|
|
|
|
rpc-whitelist-enabled = false;
|
|
|
|
rpc-host-whitelist-enabled = false;
|
|
|
|
rpc-port = uiPort;
|
|
|
|
rpc-enable = true;
|
|
|
|
rpc-bind-address = "0.0.0.0";
|
|
|
|
|
|
|
|
# "normal" speed limits
|
|
|
|
speed-limit-down-enabled = false;
|
2023-05-11 10:35:26 +02:00
|
|
|
speed-limit-down = 1000; # in Kib/s
|
2023-05-03 21:20:51 +02:00
|
|
|
speed-limit-up-enabled = true;
|
2023-05-11 10:35:26 +02:00
|
|
|
speed-limit-up = 1000; # in Kib/s
|
2023-05-03 21:20:51 +02:00
|
|
|
upload-slots-per-torrent = 8;
|
|
|
|
# Queuing
|
|
|
|
# When true, Transmission will only download
|
|
|
|
# download-queue-size non-stalled torrents at once.
|
|
|
|
download-queue-enabled = true;
|
|
|
|
download-queue-size = 3;
|
|
|
|
|
|
|
|
# When true, torrents that have not shared data for
|
|
|
|
# queue-stalled-minutes are treated as 'stalled'
|
|
|
|
# and are not counted against the queue-download-size
|
|
|
|
# and seed-queue-size limits.
|
|
|
|
queue-stalled-enabled = true;
|
|
|
|
queue-stalled-minutes = 60;
|
|
|
|
|
|
|
|
# When true. Transmission will only seed seed-queue-size
|
|
|
|
# non-stalled torrents at once.
|
|
|
|
seed-queue-enabled = false;
|
|
|
|
seed-queue-size = 10;
|
|
|
|
|
|
|
|
# Enable UPnP or NAT-PMP.
|
2023-05-04 19:35:15 +02:00
|
|
|
peer-port = peerPort;
|
2023-05-03 21:20:51 +02:00
|
|
|
port-forwarding-enabled = false;
|
2023-05-04 19:35:15 +02:00
|
|
|
announce-ip = announceIp;
|
|
|
|
announce-ip-enabled = true;
|
2023-05-03 21:20:51 +02:00
|
|
|
|
2023-05-04 19:35:15 +02:00
|
|
|
# Start torrents as soon as they are added
|
2023-05-03 21:20:51 +02:00
|
|
|
start-added-torrents = true;
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# open ports for logging
|
|
|
|
#networking.firewall.interfaces."ve-torrent".allowedTCPPorts =
|
|
|
|
# [ 5044 12304 12305 ];
|
|
|
|
#networking.firewall.interfaces."ve-torrent".allowedUDPPorts =
|
|
|
|
# [ 5044 12304 12305 ];
|
|
|
|
|
|
|
|
# host nginx setup
|
|
|
|
# ----------------
|
2023-05-04 10:12:52 +02:00
|
|
|
# curl -H "Host: sync.chungus.private" https://robi.private/ < will work
|
|
|
|
# curl -H "Host: sync.chungus.private" https://144.76.13.147/ < wont work
|
2023-05-03 21:20:51 +02:00
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
virtualHosts = {
|
|
|
|
"sync.${config.networking.hostName}.private" = {
|
|
|
|
extraConfig = ''
|
|
|
|
allow ${config.tinc.private.subnet};
|
|
|
|
deny all;
|
|
|
|
'';
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = "http://127.0.0.1:${toString uiPort}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|