summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/torrent
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-03-06 10:43:33 +0100
committertv <tv@krebsco.de>2022-03-06 10:43:33 +0100
commit5182daaaf4cadaba84331a34b5455bf9dff131b6 (patch)
treedeaa480a8ad3a9aaad6176bc14804f2bb6569c30 /makefu/2configs/torrent
parent6bcbb9adae290249988c86da35b2b5236df6ce96 (diff)
parent87a44dd1573cbdc8f0fc3553b0896b470bcfa44d (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'makefu/2configs/torrent')
-rw-r--r--makefu/2configs/torrent/rtorrent.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/makefu/2configs/torrent/rtorrent.nix b/makefu/2configs/torrent/rtorrent.nix
new file mode 100644
index 000000000..79325bfc7
--- /dev/null
+++ b/makefu/2configs/torrent/rtorrent.nix
@@ -0,0 +1,48 @@
+{ config, lib, pkgs, ... }:
+
+let
+ basicAuth = import <torrent-secrets/auth.nix>;
+ peer-port = 51412;
+ web-port = 8112;
+ daemon-port = 58846;
+ dldir = config.makefu.dl-dir;
+in {
+ services.rtorrent.enable = true;
+ services.rtorrent.user = "rtorrent";
+ services.rtorrent.group = "download";
+ services.rtorrent.downloadDir = dldir;
+ services.rtorrent.configText = ''
+ schedule2 = watch_start, 10, 10, ((load.start, (cat, (cfg.watch), "/media/cloud/watch/*.torrent")))
+ '';
+
+ services.rtorrent.openFirewall = true;
+
+ 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}";
+ };
+ };
+
+ #security.acme.certs."torrent.${config.krebs.build.host.name}.r".server = config.krebs.ssl.acmeURL;
+
+ services.nginx = {
+ enable = true;
+ virtualHosts."torrent.${config.krebs.build.host.name}.r" = {
+ # TODO
+ inherit basicAuth;
+ #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;
+ '';
+ };
+ };
+}