summary refs log tree commit diff
path: root/services/torrent/qbittorrent.nix
diff options
context:
space:
mode:
Diffstat (limited to 'services/torrent/qbittorrent.nix')
-rw-r--r--services/torrent/qbittorrent.nix49
1 files changed, 49 insertions, 0 deletions
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";
+  };
+}