diff --git a/home/program/bash/module/Transmission.sh b/home/program/bash/module/Transmission.sh new file mode 100644 index 0000000..3a3466c --- /dev/null +++ b/home/program/bash/module/Transmission.sh @@ -0,0 +1,15 @@ +# Torrent download alias. +function tdl() { + transmission-remote home.local ${@} +} + +# Download torrent files to home. +# Usage: tdla +function tdla() { + tdl -a "${@}" +} + +# List download torrents. +function tdll() { + transmission-remote home.local -l +} diff --git a/host/x86_64-linux/home/Bind.nix b/host/x86_64-linux/home/Bind.nix index f86721b..ba8bceb 100644 --- a/host/x86_64-linux/home/Bind.nix +++ b/host/x86_64-linux/home/Bind.nix @@ -6,7 +6,6 @@ let (mkBind "change" "/var/lib/changedetection-io") (mkBind "cups" "/var/lib/cups") (mkBind "davis" "/var/lib/davis") - (mkBind "deluge" "/var/lib/deluge/.config/deluge") (mkBind "dkim" "/var/dkim") (mkBind "dovecot_index" "/var/lib/dovecot/indices") (mkBind "forgejo" "/var/lib/forgejo") @@ -24,6 +23,7 @@ let (mkBind "sieve" "/var/sieve") (mkBind "tandoor" "/var/lib/tandoor-recipes") (mkBind "terraria" "/var/lib/terraria") + (mkBind "transmission" "/var/lib/transmission") (mkBind "uptime_kuma" "/var/lib/uptime-kuma") (mkBind "vaultwarden" "/var/lib/vaultwarden") (mkBind "vmail" "/var/vmail") diff --git a/host/x86_64-linux/home/Deluge.nix b/host/x86_64-linux/home/Deluge.nix deleted file mode 100644 index c36529b..0000000 --- a/host/x86_64-linux/home/Deluge.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ lib, ... }: -{ - services.deluge = { - enable = true; - web.enable = true; - }; - systemd.services.deluged.serviceConfig = { - MemoryMax = "4G"; - Restart = lib.mkForce "always"; - RuntimeMaxSec = "3h"; - }; -} diff --git a/host/x86_64-linux/home/Network.nix b/host/x86_64-linux/home/Network.nix index 23bf3c0..3b1e000 100644 --- a/host/x86_64-linux/home/Network.nix +++ b/host/x86_64-linux/home/Network.nix @@ -161,10 +161,8 @@ in ip46tables -I INPUT -j ACCEPT -i ${wan} -p tcp --dport 443 # Deluge torrenting ports. - ip46tables -I INPUT -j ACCEPT -i ${wan} -p tcp --dport 54630 - ip46tables -I INPUT -j ACCEPT -i ${wan} -p udp --dport 54630 - ip46tables -I INPUT -j ACCEPT -i ${wan} -p tcp --dport 54631 - ip46tables -I INPUT -j ACCEPT -i ${wan} -p udp --dport 54631 + ip46tables -I INPUT -j ACCEPT -i ${wan} -p tcp --dport 51413 + ip46tables -I INPUT -j ACCEPT -i ${wan} -p udp --dport 51413 # Terraria server. ip46tables -I INPUT -j ACCEPT -i ${wan} -p tcp --dport 22777 diff --git a/host/x86_64-linux/home/Transmission.nix b/host/x86_64-linux/home/Transmission.nix new file mode 100644 index 0000000..d806bfe --- /dev/null +++ b/host/x86_64-linux/home/Transmission.nix @@ -0,0 +1,45 @@ +{ pkgs, ... }: { + services.transmission = { + enable = true; + package = pkgs.transmission_4; + # REF: https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md + settings = let + downloadDir = "/storage/hot/download"; + in + { + bind-address-ipv4 = "0.0.0.0"; + bind-address-ipv6 = "::"; + cache-size-mb = 4; + dht-enabled = true; + download-dir = downloadDir; + download-queue-enabled = true; + download-queue-size = 10; + encryption = 1; + incomplete-dir-enabled = false; + message-level = 3; + peer-limit-global = 500; + peer-limit-per-torrent = 50; + peer-port = 51413; + pex-enabled = true; + port-forwarding-enabled = false; + preallocation = 1; + preferred-transport = "utp"; + rename-partial-files = true; + rpc-bind-address = "::"; + rpc-host-whitelist-enabled = false; + rpc-password = ""; + rpc-port = 9091; + rpc-username = "root"; + rpc-whitelist-enabled = false; + start-added-torrents = true; + tcp-enabled = true; + torrent-added-verify-mode = "fast"; + trash-can-enabled = false; + trash-original-torrent-files = true; + umask = 22; + utp-enabled = true; + watch-dir = "/var/lib/transmission/watchdir/"; + watch-dir-enabled = true; + }; + }; +} diff --git a/host/x86_64-linux/home/nginx/Deluge.nix b/host/x86_64-linux/home/nginx/Transmission.nix similarity index 80% rename from host/x86_64-linux/home/nginx/Deluge.nix rename to host/x86_64-linux/home/nginx/Transmission.nix index 67a05e9..3e7bd56 100644 --- a/host/x86_64-linux/home/nginx/Deluge.nix +++ b/host/x86_64-linux/home/nginx/Transmission.nix @@ -6,7 +6,7 @@ in "download.${cfg.domain}" = { inherit (cfg) sslCertificate sslCertificateKey extraConfig; locations."/" = { - proxyPass = "http://127.0.0.1:8112$request_uri"; + proxyPass = "http://[::1]:9091$request_uri"; extraConfig = cfg.allowLocal; }; }; diff --git a/package/default.nix b/package/default.nix index d5ed873..9e7bc31 100644 --- a/package/default.nix +++ b/package/default.nix @@ -102,6 +102,7 @@ swappy # Screenshot editing. sway # Sway WM. swaykbdd # Keyboard layout per-window. + transmission_4 # Torrent client. waybar # Sway bar. wf-recorder # Screen recording.