qbittorrent: added ntfy support
This commit is contained in:
parent
49542ac462
commit
94a69d6f65
|
@ -2,6 +2,9 @@ ntfy:
|
||||||
default:
|
default:
|
||||||
user: ENC[AES256_GCM,data:M9XiXH3/Nr3/3A==,iv:Ealcewpj/GCWU+U6F+7onCfVaraE+f5Wkt63tlitnlQ=,tag:ARwnlFs1VfwcQKlIkeQQeg==,type:str]
|
user: ENC[AES256_GCM,data:M9XiXH3/Nr3/3A==,iv:Ealcewpj/GCWU+U6F+7onCfVaraE+f5Wkt63tlitnlQ=,tag:ARwnlFs1VfwcQKlIkeQQeg==,type:str]
|
||||||
password: ENC[AES256_GCM,data:56el7+jh6TcI9UzeXZW5aa7cUG9ycd8a2mw=,iv:iYpkWG37dpZ4dEN5zjg4P8On969hWqWcumJ7h5hLmjk=,tag:tlGDQmJ0+xl9yO42FTp19w==,type:str]
|
password: ENC[AES256_GCM,data:56el7+jh6TcI9UzeXZW5aa7cUG9ycd8a2mw=,iv:iYpkWG37dpZ4dEN5zjg4P8On969hWqWcumJ7h5hLmjk=,tag:tlGDQmJ0+xl9yO42FTp19w==,type:str]
|
||||||
|
tokens:
|
||||||
|
homeserver: ENC[AES256_GCM,data:nQlSIXKKzTX+Ucums5IPuBcn8va6GlfGQmRZrlQsleU=,iv:KD+PmttUmCt3l6cbjjRgp6IaF5WvfJ6oSHxpzbvtDA8=,tag:ZFSGY8gDu46GTYa59v0K+Q==,type:str]
|
||||||
|
tigor: ENC[AES256_GCM,data:zDFlF8aQFzMdmwKk0xwxMQxnCIXA0sy45jMKEzDNFzs=,iv:KWveN6sbH1NTCMK+XkVUPbIIR7L2e9y6sq/WiFY9bQA=,tag:sTpuFyQ9Hwuzjvem/DO3jw==,type:str]
|
||||||
sops:
|
sops:
|
||||||
kms: []
|
kms: []
|
||||||
gcp_kms: []
|
gcp_kms: []
|
||||||
|
@ -17,8 +20,8 @@ sops:
|
||||||
VW9lVkh5eTkyLzdtK0RScHlhMTBaR28KHyMRxCQe65ZM1v4iB6mgiQxZ84/sEdr0
|
VW9lVkh5eTkyLzdtK0RScHlhMTBaR28KHyMRxCQe65ZM1v4iB6mgiQxZ84/sEdr0
|
||||||
k0tBwcBlgGK/SF6P9GdCVopFHN8os25YEYMNg8kjAh/qs4N2gTXMEQ==
|
k0tBwcBlgGK/SF6P9GdCVopFHN8os25YEYMNg8kjAh/qs4N2gTXMEQ==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
lastmodified: "2024-09-05T02:52:58Z"
|
lastmodified: "2024-09-07T11:09:18Z"
|
||||||
mac: ENC[AES256_GCM,data:CCLd4p+6V4P2ioE2lKoPctbQ9/d/DcS7m895l3+ty48JT0iZMx32gBubn0TGvdjp6x705uSYZySkM2YACFMhkifuLMxeGLGJu1rBfrXO2bYuHDAhni5fLP/XIsC+FlPbHEOXAnYpAO0y1TLBw7xKz8Tjl3yAC0L00LzIS6URir0=,iv:akFHjwnO9gtZ73NMI8pj0J87q5D6U9SiNLzfRfJUE90=,tag:CMNqOnREytCrEo+bh2l1BA==,type:str]
|
mac: ENC[AES256_GCM,data:CcmQ0JFeuXMZ1VmBiGrLFw/8fiTOLervBtmlXmpl/GvfsDk3JeTTUqPV3RoVmw4yfQ/lCpjpXKrEOrVxO+/oc+NWcuQ9OGRuluDiFg7A2GLk9vniDEtrCbk/0oibL4Hu3P4K8oDcVuJkZhoqgTwN98suk3go7RCA9VhUDtejxTM=,iv:6gVmT1I5suLGG3nS4dX5S1v6bYPzxwZw08/yHkm75pU=,tag:f1wDeoFpFVWTU/HUah3Prw==,type:str]
|
||||||
pgp: []
|
pgp: []
|
||||||
unencrypted_suffix: _unencrypted
|
unencrypted_suffix: _unencrypted
|
||||||
version: 3.8.1
|
version: 3.8.1
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
name = "qbittorrent";
|
name = "qbittorrent";
|
||||||
domain = "${name}.tigor.web.id";
|
domain = "${name}.tigor.web.id";
|
||||||
podman = config.profile.podman;
|
podman = config.profile.podman;
|
||||||
qbittorrent = podman.qbittorrent;
|
qbittorrent = podman.qbittorrent;
|
||||||
inherit (lib) mkIf;
|
inherit (lib) mkIf;
|
||||||
|
inherit (lib.strings) optionalString;
|
||||||
ip = "10.88.0.7";
|
ip = "10.88.0.7";
|
||||||
image = "lscr.io/linuxserver/qbittorrent:latest";
|
image = "lscr.io/linuxserver/qbittorrent:latest";
|
||||||
volume = "/nas/torrents";
|
volume = "/nas/torrents";
|
||||||
|
@ -23,7 +24,48 @@ in
|
||||||
chown ${uid}:${gid} ${volume} ${volume}/{config,downloads,progress,watch}
|
chown ${uid}:${gid} ${volume} ${volume}/{config,downloads,progress,watch}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
virtualisation.oci-containers.containers.${name} = {
|
|
||||||
|
sops = {
|
||||||
|
secrets =
|
||||||
|
let
|
||||||
|
opts = { sopsFile = ../../secrets/ntfy.yaml; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
"ntfy/tokens/homeserver" = opts;
|
||||||
|
};
|
||||||
|
templates = {
|
||||||
|
"qbittorrent-ntfy-env".content = /*sh*/ ''
|
||||||
|
NTFY_TOKEN=${config.sops.placeholder."ntfy/tokens/homeserver"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.oci-containers.containers.${name} =
|
||||||
|
let
|
||||||
|
finish-notify-script = pkgs.writeScriptBin "notify-finish.sh" (optionalString config.services.ntfy-sh.enable /*sh*/ ''
|
||||||
|
#!/bin/bash
|
||||||
|
# $1 = %N | Torrent Name
|
||||||
|
# $2 = %L | Category
|
||||||
|
# $3 = %G | Tags
|
||||||
|
# $4 = %F | Content Path
|
||||||
|
# $5 = %R | Root Path
|
||||||
|
# $6 = %D | Save Path
|
||||||
|
# $7 = %C | Number of files
|
||||||
|
# $8 = %Z | Torrent Size
|
||||||
|
# $9 = %T | Current Tracker
|
||||||
|
# $10 = %I | Info Hash v1
|
||||||
|
# $11 = %J | Info Hash v2
|
||||||
|
# $12 = %K | Torrent ID
|
||||||
|
|
||||||
|
curl -X POST \
|
||||||
|
-H "Authorization: Bearer $NTFY_TOKEN" \
|
||||||
|
-H "X-Title: '$1' finished downloading" \
|
||||||
|
-H "X-Tags: white_check_mark,$2" \
|
||||||
|
-d "Number of Files: $7, Size: $8" \
|
||||||
|
https://ntfy.tigor.web.id/qbittorrent-finish
|
||||||
|
'');
|
||||||
|
in
|
||||||
|
{
|
||||||
inherit image;
|
inherit image;
|
||||||
hostname = name;
|
hostname = name;
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
|
@ -39,6 +81,7 @@ in
|
||||||
"${volume}/downloads:/downloads"
|
"${volume}/downloads:/downloads"
|
||||||
"${volume}/progress:/progress"
|
"${volume}/progress:/progress"
|
||||||
"${volume}/watch:/watch"
|
"${volume}/watch:/watch"
|
||||||
|
"${finish-notify-script}/bin/notify-finish.sh:/bin/notify-finish"
|
||||||
];
|
];
|
||||||
ports = [
|
ports = [
|
||||||
"6881:6881"
|
"6881:6881"
|
||||||
|
@ -48,6 +91,9 @@ in
|
||||||
"--ip=${ip}"
|
"--ip=${ip}"
|
||||||
"--network=podman"
|
"--network=podman"
|
||||||
];
|
];
|
||||||
|
environmentFiles = [
|
||||||
|
config.sops.templates."qbittorrent-ntfy-env".path
|
||||||
|
];
|
||||||
labels = {
|
labels = {
|
||||||
"io.containers.autoupdate" = "registry";
|
"io.containers.autoupdate" = "registry";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue