feat: Port qbittorrent changes from upstream
This commit is contained in:
parent
9c9efe8a10
commit
3f4bd88199
1 changed files with 33 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, utils
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
|
@ -18,12 +19,14 @@ in
|
|||
};
|
||||
|
||||
webuiPort = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 8080;
|
||||
type = lib.types.nullOr lib.types.port;
|
||||
description = "the port passed to qbittorrent via `--webui-port`";
|
||||
};
|
||||
|
||||
torrentingPort = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = null;
|
||||
type = lib.types.nullOr lib.types.port;
|
||||
description = "the port passed to qbittorrent via `--torrenting-port`";
|
||||
};
|
||||
|
||||
|
@ -38,9 +41,27 @@ in
|
|||
default = "qbittorrent";
|
||||
description = "Group under which qbittorrent runs.";
|
||||
};
|
||||
|
||||
profileDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/qBittorrent/";
|
||||
description = "the path passed to qbittorrent via --profile.";
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd = {
|
||||
tmpfiles.settings = {
|
||||
qbittorrent = {
|
||||
"${cfg.profileDir}/qBittorrent/"."d" = {
|
||||
mode = "700";
|
||||
inherit (cfg) user group;
|
||||
};
|
||||
"${cfg.profileDir}/qBittorrent/config/"."d" = {
|
||||
mode = "700";
|
||||
inherit (cfg) user group;
|
||||
};
|
||||
};
|
||||
};
|
||||
services.qbittorrent-nox = {
|
||||
description = "qbittorrent BitTorrent client";
|
||||
wants = [ "network-online.target" ];
|
||||
|
@ -52,17 +73,24 @@ in
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
# Needed for running cross-seed's hook
|
||||
# /bin/sh -c "curl -XPOST http://localhost:2468/api/webhook --data-urlencode 'name=%N'"
|
||||
# /bin/sh -c "curl -XPOST http://localhost:2468/api/webhook?apikey=key --data-urlencode 'name=%N'"
|
||||
path = with pkgs; [
|
||||
curl
|
||||
];
|
||||
|
||||
# paths: ~/.config/qBittorrent/ and ~/.local/share/qBittorrent/
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
ExecStart = "${lib.getExe cfg.package} --webui-port=${toString cfg.webuiPort} --torrenting-port=${toString cfg.torrentingPort}";
|
||||
ExecStart = utils.escapeSystemdExecArgs (
|
||||
[
|
||||
(lib.getExe cfg.package)
|
||||
"--profile=${cfg.profileDir}"
|
||||
]
|
||||
++ lib.optional (cfg.webuiPort != null) "--webui-port=${toString cfg.webuiPort}"
|
||||
++ lib.optional (cfg.torrentingPort != null) "--torrenting-port=${toString cfg.torrentingPort}"
|
||||
++ cfg.extraArgs
|
||||
);
|
||||
|
||||
TimeoutStopSec = 1800;
|
||||
RemoveIPC = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue