aboutsummaryrefslogtreecommitdiff
path: root/modules/services/nixos/qbittorrent.nix
blob: fe2831aff87791c2183467c835af4e05c18959cd (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
{
  lib,
  config,
  ...
}: let
  cfg = config.collinux.services.qbittorrent;
in {
  config = lib.mkIf cfg.enable {
    users.users."qbittorrent" = {
      uid = 985;
      extraGroups = ["fileserver"]; # torrent files go to /media/library
    };

    networking.firewall = {
      allowedTCPPorts = [49252];
      allowedUDPPorts = [49252];
    };

    services.qbittorrent = {
      enable = true;
      webuiPort = cfg.port;
      torrentingPort = 49252;
    };
    systemd.services.qbittorrent.serviceConfig.PrivateUsers = lib.mkForce false;

    services.caddy.virtualHosts."bittorrent.ganymede".extraConfig = ''
      tls internal
      reverse_proxy 127.0.0.1:${toString cfg.port}
    '';

    collinux.services.glance.homelabServices."bittorrent" = {
      url = "https://bittorrent.ganymede";
      icon = "si:qbittorrent";
    };
  };
}