summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--machines/corsac/default.nix2
-rw-r--r--services/torrent/default.nix (renamed from services/transmission.nix)55
-rw-r--r--services/torrent/qbittorrent.nix49
-rw-r--r--services/torrent/transmission.nix52
4 files changed, 114 insertions, 44 deletions
diff --git a/machines/corsac/default.nix b/machines/corsac/default.nix
index c3d7d85..1eeb792 100644
--- a/machines/corsac/default.nix
+++ b/machines/corsac/default.nix
@@ -14,7 +14,7 @@
 
     ../../services/home-assistant.nix
     ../../services/immich.nix
-    ../../services/transmission.nix
+    ../../services/torrent
   ];
 
   foundation = {
diff --git a/services/transmission.nix b/services/torrent/default.nix
index d761bc1..4e505ba 100644
--- a/services/transmission.nix
+++ b/services/torrent/default.nix
@@ -11,10 +11,8 @@ let
   inherit (pkgs) dockerTools;
   inherit (auxiliaryPkgs) common;
 
-  transmission = pkgs.transmission_4;
-
-  transmissionLocalPort = 2018;
-  transmissionDir = "/srv/transmission";
+  torrentLocalPort = 2018;
+  torrentDir = "/srv/torrent";
 
   mtu = 1280;
 
@@ -51,13 +49,6 @@ let
     ];
   };
 
-  transmissionImage = dockerTools.streamLayeredImage {
-    name = "transmission";
-    tag = transmission.version;
-    fromImage = common.alpine.base;
-    contents = [ transmission ];
-  };
-
   gluetunImage = common.pullImage {
     name = "qmcgaw/gluetun";
     tag = "v3.39";
@@ -95,8 +86,14 @@ let
   ];
 in
 {
+  imports = [
+    # pick current client through import
+    ./transmission.nix
+    #./qbittorrent.nix
+  ];
+
   age.secrets.pia-login-secrets = {
-    file = ../secrets/pia-login-secrets.age;
+    file = ../../secrets/pia-login-secrets.age;
   };
 
   foundation = {
@@ -110,34 +107,6 @@ in
     };
 
     services = {
-      transmission = {
-        image = transmissionImage;
-
-        volumes = [
-          [
-            "${transmissionDir}/config"
-            "/var/lib/transmission/config"
-          ]
-          [
-            "${transmissionDir}/download"
-            "/var/lib/transmission/download"
-          ]
-          [
-            "${transmissionDir}/torrents"
-            "/var/lib/transmission/torrents"
-          ]
-        ];
-
-        entrypoint = lib.getExe' transmission "transmission-daemon";
-        cmd = [
-          "--foreground"
-          "--config-dir"
-          "/var/lib/transmission/config"
-        ];
-
-        customNetworkOption = "container:vpn";
-      };
-
       vpn = {
         network = "vpn";
 
@@ -145,14 +114,14 @@ in
 
         ports = [
           (common.tailnetPort me [
-            transmissionLocalPort
-            9091
+            torrentLocalPort
+            torrentLocalPort
           ])
         ];
 
         volumes = [
           [
-            "${transmissionDir}/gluetun"
+            "${torrentDir}/gluetun"
             "/gluetun"
           ]
         ];
diff --git a/services/torrent/qbittorrent.nix b/services/torrent/qbittorrent.nix
new file mode 100644
index 0000000..88bacd9
--- /dev/null
+++ b/services/torrent/qbittorrent.nix
@@ -0,0 +1,49 @@
+{
+  lib,
+  pkgs,
+  auxiliaryPkgs,
+  ...
+}:
+
+let
+  inherit (pkgs) dockerTools;
+  inherit (auxiliaryPkgs) common;
+
+  qbittorrent = pkgs.qbittorrent-nox;
+
+  torrentLocalPort = 2018;
+  torrentDir = "/srv/torrent";
+
+  qbittorrentImage = dockerTools.streamLayeredImage {
+    name = "qbittorrent";
+    tag = qbittorrent.version;
+    fromImage = common.alpine.base;
+    contents = [ qbittorrent ];
+  };
+in
+{
+  foundation.services.torrent = {
+    image = qbittorrentImage;
+
+    volumes = [
+      [
+        "${torrentDir}/qbittorrent"
+        "/qbittorrent/config"
+      ]
+      [
+        "${torrentDir}/download"
+        "/qbittorrent/download"
+      ]
+    ];
+
+    entrypoint = lib.getExe qbittorrent;
+    cmd = [
+      "--confirm-legal-notice"
+      "--profile=/qbittorrent/config"
+
+      "--webui-port=${toString torrentLocalPort}"
+    ];
+
+    customNetworkOption = "container:vpn";
+  };
+}
diff --git a/services/torrent/transmission.nix b/services/torrent/transmission.nix
new file mode 100644
index 0000000..e563e3f
--- /dev/null
+++ b/services/torrent/transmission.nix
@@ -0,0 +1,52 @@
+{
+  me,
+  config,
+  lib,
+  pkgs,
+  auxiliaryPkgs,
+  ...
+}:
+
+let
+  inherit (pkgs) dockerTools;
+  inherit (auxiliaryPkgs) common;
+
+  transmission = pkgs.transmission_4;
+
+  torrentLocalPort = 2018;
+  torrentDir = "/srv/torrent";
+
+  transmissionImage = dockerTools.streamLayeredImage {
+    name = "transmission";
+    tag = transmission.version;
+    fromImage = common.alpine.base;
+    contents = [ transmission ];
+  };
+in
+{
+  foundation.services.torrent = {
+    image = transmissionImage;
+
+    volumes = [
+      [
+        "${torrentDir}/transmission"
+        "/var/lib/transmission/config"
+      ]
+      [
+        "${torrentDir}/download"
+        "/var/lib/transmission/download"
+      ]
+    ];
+
+    entrypoint = lib.getExe' transmission "transmission-daemon";
+    cmd = [
+      "--foreground"
+      "--port"
+      "${toString torrentLocalPort}"
+      "--config-dir"
+      "/var/lib/transmission/config"
+    ];
+
+    customNetworkOption = "container:vpn";
+  };
+}