nixos-config/modules/services/transmission.nix

127 lines
3.4 KiB
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ config, lib, ... }:
with lib;
let
cfg = config.services.custom.transmission;
in {
options.services.custom.transmission = {
enable = lib.mkEnableOption "transmission";
home = lib.mkOption {
2019-12-20 05:54:26 +01:00
type = lib.types.path;
2019-10-24 02:20:38 +02:00
description = "where the configs are";
};
2019-12-20 05:54:26 +01:00
store = lib.mkOption {
type = lib.types.path;
2019-10-24 02:20:38 +02:00
description = "where to store";
};
hosts = lib.mkOption {
2019-12-20 05:54:26 +01:00
type = lib.types.str;
2019-10-24 02:20:38 +02:00
description = "allowed hostnames";
};
whitelist = lib.mkOption {
2019-12-20 05:54:26 +01:00
type = lib.types.str;
2019-10-24 02:20:38 +02:00
description = "Ip to listen to";
};
user = lib.mkOption {
2019-12-20 05:54:26 +01:00
type = lib.types.str;
2019-10-24 02:20:38 +02:00
description = "user to login";
};
password = lib.mkOption {
2019-12-20 05:54:26 +01:00
type = lib.types.str;
2019-10-24 02:20:38 +02:00
description = "password to login";
};
port = mkOption {
type = with types; int;
default = 51413;
description = ''
forwarded Port
'';
};
};
config = lib.mkIf cfg.enable {
# because 2.94 is not supported by pass the popcorn
#nixpkgs.config.packageOverrides = pkgs: {
# transmission =
# (pkgs.transmission.overrideAttrs (old: rec {
# version = "2.93";
# src = pkgs.fetchurl {
# url = "https://github.com/transmission/transmission-releases/raw/master/transmission-2.93.tar.xz";
# sha256 = "02xrp49gsv4jkbzp37qrwlnb9nlja08s92dyvgdbr6a4187945c8";
# };
# }));
#};
services.transmission = {
enable = true;
2019-12-20 05:54:26 +01:00
home = "${cfg.home}";
2019-10-24 02:20:38 +02:00
settings = {
# Downloads
2019-12-20 05:54:26 +01:00
download-dir = "${cfg.store}/downloads";
2019-10-24 02:20:38 +02:00
incomplete-dir-enabled = true;
2019-12-20 05:54:26 +01:00
incomplete-dir = "${cfg.store}/incomplete";
2019-10-24 02:20:38 +02:00
# RPC = UI connection
2019-12-20 05:54:26 +01:00
rpc-whitelist = "${cfg.whitelist}";
rpc-host-whitelist = "${cfg.hosts}";
rpc-user = "${cfg.user}";
rpc-username = "${cfg.user}";
rpc-password = "${cfg.password}";
2019-10-24 02:20:38 +02:00
# Start torrents as soon as they are added
2019-12-20 05:54:26 +01:00
start-added-torrents = true;
2019-10-24 02:20:38 +02:00
# Encryption may help get around some ISP filtering,
# but at the cost of slightly higher CPU use.
# 0 = Prefer unencrypted connections,
# 1 = Prefer encrypted connections,
# 2 = Require encrypted connections; default = 1)
encryption = 2;
# Enable Local Peer Discovery (LPD).
2019-12-20 05:54:26 +01:00
lpd-enabled = true;
2019-10-24 02:20:38 +02:00
# Enable UPnP or NAT-PMP.
peer-port = cfg.port;
2019-12-20 05:54:26 +01:00
port-forwarding-enabled = true;
2019-10-24 02:20:38 +02:00
# "normal" speed limits
speed-limit-down-enabled = true;
2019-12-20 05:54:26 +01:00
speed-limit-down = 800;
speed-limit-up-enabled = true;
speed-limit-up = 50;
2019-10-24 02:20:38 +02:00
upload-slots-per-torrent = 8;
# Queuing
# When true, Transmission will only download
# download-queue-size non-stalled torrents at once.
2019-12-20 05:54:26 +01:00
download-queue-enabled = true;
download-queue-size = 1;
2019-10-24 02:20:38 +02:00
# 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.
2019-12-20 05:54:26 +01:00
queue-stalled-enabled = true;
queue-stalled-minutes = 60;
2019-10-24 02:20:38 +02:00
# When true. Transmission will only seed seed-queue-size
# non-stalled torrents at once.
2019-12-20 05:54:26 +01:00
seed-queue-enabled = true;
seed-queue-size = 10;
2019-10-24 02:20:38 +02:00
# umask of the moves that got downloaded
umask = 18;
};
};
};
}