From f229114af8ffff941fbbd22de1b0edc1d18dbf1b Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 5 Sep 2025 23:31:37 +0200 Subject: Place alternative web UI (Flood) in front of BT clients Signed-off-by: Mel --- services/torrent/default.nix | 1 + services/torrent/flood.nix | 66 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 services/torrent/flood.nix 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; + }; + }; +} -- cgit 1.4.1