summary refs log tree commit diff
path: root/services/torrent/qbittorrent.nix
blob: 88bacd9cf9348383361c6fdf09bb17c61384b1b8 (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
{
  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";
  };
}