qbt download finish webhook
This commit is contained in:
parent
01538e9f73
commit
90d782a935
4 changed files with 24 additions and 6 deletions
|
@ -1,13 +1,19 @@
|
||||||
{ abs, lib, pkgs, ... }@inputs:
|
{ abs, lib, pkgs, config, ... }@inputs:
|
||||||
let
|
let
|
||||||
containers = (import (abs "lib/containers.nix") inputs);
|
containers = (import (abs "lib/containers.nix") inputs);
|
||||||
|
secrets = import (abs "lib/secrets.nix");
|
||||||
vueTorrent = pkgs.fetchurl {
|
vueTorrent = pkgs.fetchurl {
|
||||||
url = "https://github.com/WDaan/VueTorrent/releases/download/v2.4.0/vuetorrent.zip";
|
url = "https://github.com/WDaan/VueTorrent/releases/download/v2.4.0/vuetorrent.zip";
|
||||||
hash = "sha256-ZM2AAJVqlzCXxvWnWhYDVBXZqpe0NzkFfYLvUTyzlZM=";
|
hash = "sha256-ZM2AAJVqlzCXxvWnWhYDVBXZqpe0NzkFfYLvUTyzlZM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dlWebhook = secrets.mount config "qbt-dl-webhook";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
(secrets.declare [
|
||||||
|
{ name = "qbt-dl-webhook"; mode = "777"; }
|
||||||
|
])
|
||||||
(containers.mkNixosContainer {
|
(containers.mkNixosContainer {
|
||||||
name = "torrent";
|
name = "torrent";
|
||||||
ephemeral = false;
|
ephemeral = false;
|
||||||
|
@ -23,8 +29,10 @@ in
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
|
AmbientCapabilities = "CAP_NET_BIND_SERVICE";
|
||||||
};
|
};
|
||||||
setup = ''
|
setup = { config, ... }: ''
|
||||||
mkdir -p /var/lib/qbittorrent/temp
|
mkdir -p /var/lib/qbittorrent/temp
|
||||||
|
dl_webhook=`cat ${dlWebhook.path}`
|
||||||
|
sed -i "s|%DL_WEBHOOK%|$dl_webhook|g" ${config}
|
||||||
'';
|
'';
|
||||||
config = {
|
config = {
|
||||||
Preferences = {
|
Preferences = {
|
||||||
|
@ -45,6 +53,10 @@ in
|
||||||
"Proxy\\Type" = "SOCKS5";
|
"Proxy\\Type" = "SOCKS5";
|
||||||
"Proxy\\HostnameLookupEnabled" = "true";
|
"Proxy\\HostnameLookupEnabled" = "true";
|
||||||
};
|
};
|
||||||
|
AutoRun = {
|
||||||
|
enabled = "true";
|
||||||
|
program = "curl \\\"%DL_WEBHOOK%\\\" -X POST -d \\\"%N\\\"";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
@ -56,7 +68,7 @@ in
|
||||||
hostPath = "/mnt/puffer/Downloads";
|
hostPath = "/mnt/puffer/Downloads";
|
||||||
isReadOnly = false;
|
isReadOnly = false;
|
||||||
};
|
};
|
||||||
};
|
} // (dlWebhook.mounts);
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,12 @@
|
||||||
mount = config: name:
|
mount = config: name:
|
||||||
let
|
let
|
||||||
path = config.age.secrets.${name}.path;
|
path = config.age.secrets.${name}.path;
|
||||||
|
localPath = "/mnt/secrets/${name}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
path = path;
|
path = localPath;
|
||||||
mounts = {
|
mounts = {
|
||||||
${path} = {
|
${localPath} = {
|
||||||
hostPath = path;
|
hostPath = path;
|
||||||
isReadOnly = true;
|
isReadOnly = true;
|
||||||
};
|
};
|
||||||
|
|
5
secrets/qbt-dl-webhook.age
Normal file
5
secrets/qbt-dl-webhook.age
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
age-encryption.org/v1
|
||||||
|
-> ssh-ed25519 sj88Xw 7DkrB33/l5p6R9b0FSQUXVfagN1dqUeJDfBrp5gVFUM
|
||||||
|
AnDczrbwG6pYR8ReTyIbOfi8B4YbS2xgcc2Fc+KDEbo
|
||||||
|
--- KosaQlB/8ZGXC+wavmN1G79YfiTgkPnNATZur/xHFOI
|
||||||
|
ÃMÝCžæû̹T¬aÚ‡ºyw°…Ö9x{žnhœ‘XÝô¤è&+é@NÌ9Aèô‹Ú{~–~d|R<>o_MÜî&U[‘ÁÀMšK®àÄAžÀ´ÿmÚ‹
|
|
@ -70,7 +70,7 @@ in
|
||||||
|
|
||||||
mkdir -p ${dataDir}/qBittorrent/config
|
mkdir -p ${dataDir}/qBittorrent/config
|
||||||
cp ${iniFile} ${dataDir}/qBittorrent/config/qBittorrent.conf
|
cp ${iniFile} ${dataDir}/qBittorrent/config/qBittorrent.conf
|
||||||
${setup}
|
${setup { inherit dataDir; config = "${dataDir}/qBittorrent/config/qBittorrent.conf"; }}
|
||||||
${package}/bin/qbittorrent-nox --webui-port=${toString port} --profile=${dataDir}
|
${package}/bin/qbittorrent-nox --webui-port=${toString port} --profile=${dataDir}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue