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