diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-06-08 21:04:49 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-06-10 16:18:26 +0530 |
| commit | 7a8a09cdc21939fc2e6bc2c762e9b89cf87feb91 (patch) | |
| tree | 4f48e0b2ccfa85b1fdd5f7b28e8b72082b7df60c | |
| parent | 969a9a311d24548c6632ddcdc4f903ffa48c5ca6 (diff) | |
| download | homeserver-nixos-config-7a8a09cdc21939fc2e6bc2c762e9b89cf87feb91.tar.gz homeserver-nixos-config-7a8a09cdc21939fc2e6bc2c762e9b89cf87feb91.zip | |
Refactor transmission + expose transmission rpc port
| -rw-r--r-- | modules/media/config.nix | 1 | ||||
| -rw-r--r-- | modules/media/default.nix | 29 | ||||
| -rw-r--r-- | modules/media/torrent.nix | 39 |
3 files changed, 43 insertions, 26 deletions
diff --git a/modules/media/config.nix b/modules/media/config.nix index 1703901..0fb427e 100644 --- a/modules/media/config.nix +++ b/modules/media/config.nix @@ -10,6 +10,7 @@ rec { sonarrPort = 8989; prowlarrPort = 9696; jellyfinPort = 8096; + transmissionPort = 9091; group = "multimedia"; } diff --git a/modules/media/default.nix b/modules/media/default.nix index 0708d8e..c8b01a4 100644 --- a/modules/media/default.nix +++ b/modules/media/default.nix @@ -1,8 +1,10 @@ -{ pkgs, ... }: +{ ... }: let config = import ./config.nix; in { + imports = [ ./torrent.nix ]; + systemd.tmpfiles.rules = [ "d ${config.mediaBaseDir} 0770 - ${config.group} - -" "d ${config.downloadsDir} 0770 - ${config.group} - -" @@ -45,29 +47,4 @@ in openFirewall = true; group = config.group; }; - - services.transmission = { - enable = true; - group = config.group; - settings = { - "download-dir" = config.downloadsDir; - "download-queue-enabled" = true; - "download-queue-size" = 5; - "peer-port" = 51413; - "peer-port-random-high" = 65535; - "peer-port-random-low" = 49152; - "prefetch-enabled" = true; - "rename-partial-files" = true; - "rpc-authentication-required" = false; - "rpc-bind-address" = "127.0.0.1"; - "rpc-enabled" = true; - "rpc-port" = 9091; - "rpc-whitelist-enabled" = true; - "script-torrent-done-enabled" = false; - "start-added-torrents" = true; - "trash-original-torrent-files" = false; - "umask" = 18; - "utp-enabled" = true; - }; - }; } diff --git a/modules/media/torrent.nix b/modules/media/torrent.nix new file mode 100644 index 0000000..9fd0b96 --- /dev/null +++ b/modules/media/torrent.nix @@ -0,0 +1,39 @@ +{ pkgs, ... }: +let + config = import ./config.nix; +in +{ + environment.systemPackages = with pkgs; [ + tremc + ]; + + services.transmission = { + enable = true; + group = config.group; + openRPCPort = true; + settings = { + "download-dir" = config.downloadsDir; + "download-queue-enabled" = true; + "download-queue-size" = 5; + "peer-port" = 51413; + "peer-port-random-high" = 65535; + "peer-port-random-low" = 49152; + "prefetch-enabled" = true; + "rename-partial-files" = true; + "rpc-authentication-required" = false; + "rpc-bind-address" = "0.0.0.0"; + "rpc-enabled" = true; + "rpc-port" = config.transmissionPort; + "rpc-whitelist-enabled" = false; + "script-torrent-done-enabled" = false; + "start-added-torrents" = true; + "trash-original-torrent-files" = false; + "umask" = 18; + "utp-enabled" = true; + }; + }; + + systemd.services.transmission.unitConfig = { + RequiresMountsFor = config.mediaBaseDir; + }; +} |
