summary refs log tree commit diff
path: root/services
diff options
context:
space:
mode:
Diffstat (limited to 'services')
-rw-r--r--services/torrent/default.nix1
-rw-r--r--services/torrent/flood.nix66
2 files changed, 67 insertions, 0 deletions
diff --git a/services/torrent/default.nix b/services/torrent/default.nix
index 4e505ba..7fed955 100644
--- a/services/torrent/default.nix
+++ b/services/torrent/default.nix
@@ -87,6 +87,7 @@ let
 in
 {
   imports = [
+    ./flood.nix
     # pick current client through import
     ./transmission.nix
     #./qbittorrent.nix
diff --git a/services/torrent/flood.nix b/services/torrent/flood.nix
new file mode 100644
index 0000000..ae0385e
--- /dev/null
+++ b/services/torrent/flood.nix
@@ -0,0 +1,66 @@
+{
+  lib,
+  pkgs,
+  me,
+  unstablePkgs,
+  auxiliaryPkgs,
+  ...
+}:
+
+let
+  inherit (pkgs) dockerTools mediainfo;
+  inherit (auxiliaryPkgs) common;
+
+  flood = unstablePkgs.flood;
+
+  torrentLocalPort = 2018;
+  torrentWebLocalPort = 2019;
+  torrentDir = "/srv/torrent";
+
+  floodImage = dockerTools.streamLayeredImage {
+    name = "flood";
+    tag = flood.version;
+    fromImage = common.alpine.base;
+    contents = [ flood mediainfo ];
+  };
+in
+{
+  foundation.services.torrent-webui = {
+    image = floodImage;
+
+    ports = [ torrentWebLocalPort ];
+
+    volumes = [
+      [
+        "${torrentDir}/download"
+        "/download"
+      ]
+    ];
+
+    entrypoint = lib.getExe flood;
+    cmd = [
+      "--host" "0.0.0.0"
+      "--port" "${toString torrentWebLocalPort}"
+      "--rundir" "${torrentDir}/flood"
+      "--auth" "none"
+
+      # pick one according to which is running!
+      # "--qburl" "http://${me.tailscale.ip}:${toString torrentLocalPort}"
+      # "--qbuser" "admin"
+      # "--qbpass" "admin"
+      "--trurl" "http://${me.tailscale.ip}:${toString torrentLocalPort}/transmission/rpc"
+      "--truser" "admin"
+      "--trpass" "admin"
+    ];
+  };
+
+  services.nginx.virtualHosts."bt.rnrd.fyi" = {
+    useACMEHost = "rnrd.fyi";
+    forceSSL = true;
+    listenAddresses = [ me.tailscale.ip ];
+    locations."/" = {
+      proxyPass = "http://127.0.0.1:${toString torrentWebLocalPort}/";
+      recommendedProxySettings = true;
+    };
+  };
+}