2016-08-21 09:55:46 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
2016-12-22 14:41:49 +00:00
|
|
|
basicAuth = import <torrent-secrets/auth.nix>;
|
2016-08-21 09:55:46 +00:00
|
|
|
peer-port = 51412;
|
|
|
|
web-port = 8112;
|
|
|
|
daemon-port = 58846;
|
2022-03-01 22:20:22 +00:00
|
|
|
dldir = config.makefu.dl-dir;
|
2016-08-21 09:55:46 +00:00
|
|
|
in {
|
2022-06-06 19:24:11 +00:00
|
|
|
services.rtorrent = {
|
|
|
|
enable = true;
|
|
|
|
user = "rtorrent";
|
|
|
|
port = peer-port;
|
|
|
|
openFirewall = true;
|
|
|
|
group = "download";
|
|
|
|
downloadDir = dldir;
|
|
|
|
configText = ''
|
|
|
|
schedule2 = watch_start, 10, 10, ((load.start, (cat, (cfg.watch), "/media/cloud/watch/*.torrent")))
|
|
|
|
'';
|
|
|
|
};
|
2016-08-24 10:16:18 +00:00
|
|
|
|
2022-03-01 22:20:22 +00:00
|
|
|
systemd.services.flood = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
wants = [ "rtorrent.service" ];
|
|
|
|
after = [ "rtorrent.service" ];
|
|
|
|
serviceConfig = {
|
|
|
|
User = "rtorrent";
|
|
|
|
ExecStart = "${pkgs.nodePackages.flood}/bin/flood --auth none --port ${toString web-port} --rtsocket ${config.services.rtorrent.rpcSocket}";
|
2016-08-21 09:55:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-03-01 22:20:22 +00:00
|
|
|
#security.acme.certs."torrent.${config.krebs.build.host.name}.r".server = config.krebs.ssl.acmeURL;
|
|
|
|
|
|
|
|
services.nginx = {
|
2016-08-21 09:55:46 +00:00
|
|
|
enable = true;
|
2022-03-01 22:20:22 +00:00
|
|
|
virtualHosts."torrent.${config.krebs.build.host.name}.r" = {
|
|
|
|
# TODO
|
2016-12-22 14:41:49 +00:00
|
|
|
inherit basicAuth;
|
2022-03-01 22:20:22 +00:00
|
|
|
#enableACME = true;
|
|
|
|
#addSSL = true;
|
|
|
|
root = "${pkgs.nodePackages.flood}/lib/node_modules/flood/dist/assets";
|
|
|
|
locations."/api".extraConfig = ''
|
|
|
|
proxy_pass http://localhost:${toString web-port};
|
|
|
|
'';
|
|
|
|
locations."/".extraConfig = ''
|
|
|
|
try_files $uri /index.html;
|
|
|
|
'';
|
2016-08-21 09:55:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|