nixos-config/modules/services/transmission.nix
Ingolf Wagner 54bab918d7
init
2019-10-24 02:24:33 +02:00

128 lines
3.5 KiB
Nix

{ config, lib, ... }:
with lib;
let
cfg = config.services.custom.transmission;
in {
options.services.custom.transmission = {
enable = lib.mkEnableOption "transmission";
home = lib.mkOption {
type = lib.types.path;
description = "where the configs are";
};
store = lib.mkOption {
type = lib.types.path;
description = "where to store";
};
hosts = lib.mkOption {
type = lib.types.str;
description = "allowed hostnames";
};
whitelist = lib.mkOption {
type = lib.types.str;
description = "Ip to listen to";
};
user = lib.mkOption {
type = lib.types.str;
description = "user to login";
};
password = lib.mkOption {
type = lib.types.str;
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;
home = "${cfg.home}";
settings = {
# Downloads
download-dir = "${cfg.store}/downloads";
incomplete-dir-enabled = true;
incomplete-dir = "${cfg.store}/incomplete";
# RPC = UI connection
rpc-whitelist = "${cfg.whitelist}";
rpc-host-whitelist = "${cfg.hosts}";
rpc-user = "${cfg.user}";
rpc-username = "${cfg.user}";
rpc-password = "${cfg.password}";
# Start torrents as soon as they are added
start-added-torrents = true;
# 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).
lpd-enabled = true;
# Enable UPnP or NAT-PMP.
peer-port = cfg.port;
port-forwarding-enabled = true;
# "normal" speed limits
speed-limit-down-enabled = true;
speed-limit-down = 800;
speed-limit-up-enabled = true ;
speed-limit-up = 50;
upload-slots-per-torrent = 8;
# Queuing
# When true, Transmission will only download
# download-queue-size non-stalled torrents at once.
download-queue-enabled = true;
download-queue-size = 1;
# 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.
queue-stalled-enabled = true;
queue-stalled-minutes = 60;
# When true. Transmission will only seed seed-queue-size
# non-stalled torrents at once.
seed-queue-enabled = true;
seed-queue-size = 10;
# umask of the moves that got downloaded
umask = 18;
};
};
};
}