configuration.nix/hosts/layne/services/apps/transmission.nix

83 lines
2.3 KiB
Nix
Raw Normal View History

2024-09-14 19:36:59 +05:30
{ pkgs, ... }:
let
2024-10-31 14:39:20 +05:30
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
2024-09-14 19:36:59 +05:30
in
{
2024-07-17 10:45:56 +05:30
services = {
caddy = {
virtualHosts."transmission.labs.adtya.xyz" = {
2024-10-27 23:09:50 +05:30
inherit logFormat;
2024-07-17 10:45:56 +05:30
extraConfig = ''
reverse_proxy 127.0.0.1:9091
2024-07-17 10:45:56 +05:30
'';
};
};
transmission = {
user = "mediaserver";
group = "mediaserver";
2024-07-17 10:45:56 +05:30
enable = true;
package = pkgs.transmission_4;
downloadDirPermissions = "775";
home = "/mnt/data/Torrents";
webHome = pkgs.flood-for-transmission;
openPeerPorts = true;
extraFlags = [
"--encryption-required"
"--no-portmap"
"--dht"
"--lpd"
];
settings = {
2024-10-28 00:08:41 +05:30
peer-port = 36840;
rpc-bind-address = "127.0.0.1";
2024-07-17 10:45:56 +05:30
rpc-port = 9091;
rpc-host-whitelist = "transmission.labs.adtya.xyz";
2024-07-17 10:45:56 +05:30
watch-dir-enabled = true;
preallocation = 2;
alt-speed-time-enabled = true;
alt-speed-time-begin = 360; # 6AM
alt-speed-time-end = 1320; # 10PM
alt-speed-time-day = 127; # 1111111 (Everyday)
alt-speed-down = 10240;
alt-speed-up = 8192;
speed-limit-down-enabled = true;
speed-limit-down = 20480;
speed-limit-up-enabled = true;
speed-limit-up = 16384;
idle-seeding-limit-enabled = true;
2024-10-27 17:49:45 +05:30
idle-seeding-limit = 360;
ratio-limit-enabled = true;
2024-10-27 17:49:45 +05:30
ratio-limit = 2;
download-queue-enabled = true;
download-queue-size = 5;
queue-stalled-enabled = true;
queue-stalled-minutes = 30;
seed-queue-enabled = true;
seed-queue-size = 15;
peer-limit-global = 400;
peer-limit-per-torrent = 20;
2024-07-17 10:45:56 +05:30
};
2024-07-04 01:13:49 +05:30
};
};
systemd.services.transmission.unitConfig.RequiresMountsFor = [ "/mnt/data" ];
2024-10-25 23:01:26 +05:30
systemd.timers.transmission-port-mapping = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "*:*:00/30";
Unit = "transmission-port-mapping.service";
};
};
systemd.services.transmission-port-mapping = {
script = ''
set -eu
${pkgs.libnatpmp}/bin/natpmpc -g 10.2.0.1 -a 1 0 tcp 60
${pkgs.libnatpmp}/bin/natpmpc -g 10.2.0.1 -a 1 0 udp 60
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
2024-07-04 01:13:49 +05:30
}