64 lines
1.9 KiB
Nix
64 lines
1.9 KiB
Nix
{ lib, config, pkgs, proxyReverse, ... }:
|
|
let
|
|
port = 9091;
|
|
ports = [ port 51413 ];
|
|
in {
|
|
options.my.servers.qbittorrent.enable = lib.mkEnableOption "enable";
|
|
config = lib.mkIf config.my.servers.qbittorrent.enable {
|
|
systemd = {
|
|
packages = [ pkgs.qbittorrent-nox ];
|
|
services = {
|
|
"qbittorrent-nox@jawz" = {
|
|
enable = true;
|
|
overrideStrategy = "asDropin";
|
|
wantedBy = [ "multi-user.target" ];
|
|
};
|
|
};
|
|
user = {
|
|
services = {
|
|
qbit_manage = {
|
|
restartIfChanged = true;
|
|
description = "Tidy up my torrents";
|
|
wantedBy = [ "default.target" ];
|
|
path = [ pkgs.python3 pkgs.pipenv ];
|
|
serviceConfig = let env = "/home/jawz/Development/Git/qbit_manage";
|
|
in {
|
|
Restart = "on-failure";
|
|
RestartSec = 30;
|
|
ExecStart =
|
|
"${env}/venv/bin/python3 ${env}/qbit_manage.py -r -c ${env}/config.yml";
|
|
};
|
|
};
|
|
unpackerr = {
|
|
enable = false;
|
|
restartIfChanged = true;
|
|
description = "Run unpackerr";
|
|
wantedBy = [ "default.target" ];
|
|
serviceConfig = {
|
|
Restart = "on-failure";
|
|
RestartSec = 30;
|
|
ExecStart =
|
|
"${pkgs.unpackerr}/bin/unpackerr -c /home/jawz/.config/unpackerr.conf";
|
|
};
|
|
};
|
|
};
|
|
timers.qbit_manage = {
|
|
enable = true;
|
|
description = "Tidy up my torrents";
|
|
wantedBy = [ "timers.target" ];
|
|
timerConfig = { OnCalendar = "*:0/10"; };
|
|
};
|
|
};
|
|
};
|
|
services.nginx = {
|
|
enable = true;
|
|
virtualHosts."xfwmrle6h6skqujbeizw.${config.my.domain}" =
|
|
proxyReverse port // { };
|
|
};
|
|
networking.firewall = {
|
|
allowedTCPPorts = ports;
|
|
allowedUDPPorts = ports;
|
|
};
|
|
};
|
|
}
|