46 lines
1.4 KiB
Nix
46 lines
1.4 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
ook,
|
|
self,
|
|
...
|
|
}: let
|
|
ookflixLib = import ./lib.nix {inherit lib config self;};
|
|
inherit (ookflixLib) mkServiceUser mkServiceStateDir;
|
|
inherit (lib) mkIf;
|
|
inherit (ook.lib.container) mkContainerLabel mkContainerEnvironment;
|
|
inherit (config.ooknet.server.ookflix) groups volumes;
|
|
inherit (config.ooknet.server.ookflix.services) qbittorrent;
|
|
in {
|
|
config = mkIf qbittorrent.enable {
|
|
users = mkServiceUser qbittorrent.user.name;
|
|
systemd.tmpfiles = mkServiceStateDir "qbittorrent" qbittorrent.stateDir;
|
|
virtualisation.oci-containers.containers = {
|
|
# Torrent client
|
|
qbittorrent = {
|
|
image = "ghcr.io/hotio/qbittorrent";
|
|
dependsOn = ["gluetun"];
|
|
volumes = [
|
|
"${qbittorrent.stateDir}:/config"
|
|
"${volumes.torrents.root}:/data/torrents"
|
|
];
|
|
extraOptions = ["--network=container:gluetun"];
|
|
labels = mkContainerLabel {
|
|
name = "qbittorrent";
|
|
inherit (qbittorrent) port domain;
|
|
homepage = {
|
|
group = "downloads";
|
|
description = "torrent client";
|
|
};
|
|
};
|
|
environment =
|
|
mkContainerEnvironment qbittorrent.user.id groups.downloads.id
|
|
// {
|
|
UMASK = "002";
|
|
WEBUI_PORTS = "${toString qbittorrent.port}/tcp,${toString qbittorrent.port}/udp";
|
|
TORRENTING_PORT = "${toString qbittorrent.torrentPort}";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|