Compare commits

..

No commits in common. "aa0a3bf6c9a1f52851e74183bb9765a8750005ac" and "306fedddb807cee27a344f7749939c4388d8e199" have entirely different histories.

View file

@ -9,44 +9,26 @@ let
domain = config.networking.domain; domain = config.networking.domain;
webuiDomain = "transmission.${domain}"; webuiDomain = "transmission.${domain}";
transmissionRpcPort = 9091;
transmissionPeerPort = 30251;
downloadBase = "/data/downloads/"; # NOTE: to be excluded from backups
in in
{ {
options.my.services.transmission = with lib; { options.my.services.transmission = with lib; {
enable = mkEnableOption "Transmission torrent client"; enable = mkEnableOption "Transmission torrent client";
username = mkOption { username = mkOption {
type = types.str; type = types.str;
default = "Ambroisie"; default = "Ambroisie";
example = "username"; example = "username";
description = "Name of the transmission RPC user"; description = "Name of the transmission RPC user";
}; };
password = mkOption { password = mkOption {
type = types.str; type = types.str;
example = "password"; example = "password";
description = "Password of the transmission RPC user"; description = "Password of the transmission RPC user";
}; };
downloadBase = mkOption {
type = types.str;
default = "/data/downloads/";
example = "/var/lib/transmission/download";
description = "Download base directory";
};
privatePort = mkOption {
type = types.port;
default = 9091;
example = 8080;
description = "Internal port for webui";
};
peerPort = mkOption {
type = types.port;
default = 30251;
example = 32323;
description = "Peering port";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -54,16 +36,15 @@ in
enable = true; enable = true;
group = "media"; group = "media";
downloadDirPermissions = "775";
settings = { settings = {
download-dir = "${cfg.downloadBase}/complete"; download-dir = "${downloadBase}/complete";
incomplete-dir = "${cfg.downloadBase}/incomplete"; incomplete-dir = "${downloadBase}/incomplete";
umask = 0; # Make it world-writeable
peer-port = cfg.peerPort; peer-port = transmissionPeerPort;
rpc-enabled = true; rpc-enabled = true;
rpc-port = cfg.privatePort; rpc-port = transmissionRpcPort;
rpc-authentication-required = true; rpc-authentication-required = true;
rpc-username = cfg.username; rpc-username = cfg.username;
@ -81,12 +62,12 @@ in
forceSSL = true; forceSSL = true;
useACMEHost = domain; useACMEHost = domain;
locations."/".proxyPass = "http://localhost:${toString cfg.privatePort}"; locations."/".proxyPass = "http://localhost:${toString transmissionRpcPort}";
}; };
networking.firewall = { networking.firewall = {
allowedTCPPorts = [ cfg.peerPort ]; allowedTCPPorts = [ transmissionPeerPort ];
allowedUDPPorts = [ cfg.peerPort ]; allowedUDPPorts = [ transmissionPeerPort ];
}; };
}; };
} }