Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from rtorrent+flood to transmission #295

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
./shared/bookmarks/options.nix
./shared/umami/options.nix
./shared/concourse/options.nix
./shared/rtorrent/options.nix
./shared/torrents/options.nix
./shared/oci-containers/options.nix
./shared/pleroma/options.nix
./shared/resolved/options.nix
Expand Down
13 changes: 7 additions & 6 deletions hosts/nyarlathotep/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ in
services.caddy.virtualHosts."flood.nyarlathotep.lan:80".extraConfig = ''
import restrict_vlan
encode gzip
reverse_proxy http://localhost:${toString config.nixfiles.rtorrent.flood.port}
reverse_proxy http://localhost:${toString config.nixfiles.torrents.rpcPort}
'';

services.caddy.virtualHosts."finder.nyarlathotep.lan:80".extraConfig = ''
Expand Down Expand Up @@ -337,13 +337,14 @@ in


###############################################################################
## rTorrent
## torrents
###############################################################################

nixfiles.rtorrent.enable = true;
nixfiles.rtorrent.downloadDir = "/mnt/nas/torrents/files/";
nixfiles.rtorrent.watchDir = "/mnt/nas/torrents/watch/";
nixfiles.rtorrent.user = "barrucadu";
nixfiles.torrents.enable = true;
nixfiles.torrents.downloadDir = "/mnt/nas/torrents/files";
nixfiles.torrents.watchDir = "/mnt/nas/torrents/watch";
nixfiles.torrents.user = "barrucadu";
nixfiles.torrents.group = "users";


###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Directories to link
MEDIA_DIRS = ["/mnt/nas/anime", "/mnt/nas/movies", "/mnt/nas/tv"]

# Where rtorrent downloads its files to
# Where torrent files are downloaded to
TORRENT_FILES_DIR = "/mnt/nas/torrents/files"

# Where .torrent files are stored
Expand Down
2 changes: 1 addition & 1 deletion shared/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ in
./pleroma
./resolved
./restic-backups
./rtorrent
./torrents
./umami
];

Expand Down
97 changes: 0 additions & 97 deletions shared/rtorrent/default.nix

This file was deleted.

21 changes: 0 additions & 21 deletions shared/rtorrent/erase-your-darlings.nix

This file was deleted.

89 changes: 0 additions & 89 deletions shared/rtorrent/options.nix

This file was deleted.

60 changes: 60 additions & 0 deletions shared/torrents/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# [Transmission][] is a bittorrent client. This module configures it along with
# a web UI.
#
# This module does not include a backup script. Torrented files must be backed
# up independently.
#
# **Erase your darlings:** transparently stores session data on the persistent
# volume.
#
# [Transmission]: https://transmissionbt.com/
{ config, lib, pkgs, ... }:

with lib;
let
cfg = config.nixfiles.torrents;
in
{
imports = [
./erase-your-darlings.nix
./options.nix
];

config = mkIf cfg.enable {
services.transmission = {
enable = true;
user = cfg.user;
group = cfg.group;
home = "${cfg.stateDir}/transmission";
openPeerPorts = cfg.openFirewall;
webHome = pkgs.flood-for-transmission;
settings = {
# paths
download-dir = cfg.downloadDir;
watch-dir = cfg.watchDir;
watch-dir-enabled = true;
incomplete-dir-enabled = false;

# optimise for private trackers (disable DHT and PEX, force encryption)
encryption = 2;
dht-enabled = false;
pex-enabled = false;

# peers
peer-port = cfg.peerPort;
peer-port-random-on-start = false;

# rpc
rpc-bind-address = "127.0.0.1";
rpc-port = cfg.rpcPort;
rpc-host-whitelist-enabled = false;

# misc
message-level = cfg.logLevel;
rename-partial-files = false;
trash-can-enabled = false;
trash-original-torrent-files = false;
};
};
};
}
12 changes: 12 additions & 0 deletions shared/torrents/erase-your-darlings.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ config, lib, ... }:

with lib;
let
cfg = config.nixfiles.torrents;
eyd = config.nixfiles.eraseYourDarlings;
in
{
config = mkIf (cfg.enable && eyd.enable) {
nixfiles.torrents.stateDir = "${toString eyd.persistDir}/var/lib/torrents";
};
}
Loading