summary refs log tree commit diff
path: root/services/torrent/transmission.nix
blob: e563e3f9464a81a91babeae21cb72c68e0b23a7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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";
  };
}