summaryrefslogtreecommitdiff
path: root/hosts/ahmed/torrenting/default.nix
blob: c49baa6be88a8976f4f8ddf72fe184ed1ebd6f37 (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
# This module configures the my torrenting setup. It uses qBittorrent over a VPN.
{pkgs, options, config, ...}: let
  downloadPath = "/srv/media/";

  interface = "tun0";
in {
  # Configure the actual qBittorrent service.
  services.qbittorrent = {
    enable = true;

    openFirewall = true; # TEMP: reverse proxy will cover this instead

    settings = {
      BitTorrent = {
        # Use the specified download path for finished torrents.
        "Session\\DefaultSavePath" = downloadPath;
        "Session\\TempPath" = "${config.services.qbittorrent.profile}/qBittorrent/temp";
        "Session\\TempPathEnabled" = true;
      };

      # Instruct qBittorrent to only use VPN interface.
    };
  };

  # Create the directory to which media will be downloaded.
  # This is also used by Jellyfin to serve the files.
  systemd.tmpfiles.rules = let
    user = options.services.qbittorrent.user.default;
    group = options.services.qbittorrent.group.default;
  in [
    "d ${downloadPath} 0755 ${user} ${group}"
  ];

  # Create a connection to Mullvad's WireGuard server.

  # Use NGINX as a reverse proxy for qBittorrent's WebUI.
}