feat(qbit): add vuetorrent update script
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-03-28 13:51:07 -04:00
parent 7540add6ee
commit 2f497101fa
3 changed files with 43 additions and 12 deletions

View file

@ -7,14 +7,18 @@
cfg = config.services.qbittorrent;
pkg = pkgs.qbittorrent-nox;
vue = pkgs.stdenv.mkDerivation {
vue = let
gen = import ./vuetorrent.nix;
in
pkgs.stdenv.mkDerivation {
name = "vuetorrent";
inherit (gen) version;
nativeBuildInputs = [pkgs.unzip];
buildInputs = [pkgs.unzip];
src = pkgs.fetchurl {
url = "https://github.com/VueTorrent/VueTorrent/releases/download/v2.7.1/vuetorrent.zip";
hash = "sha256-/6biiWVgYQF7SpiY3JmcW4NDAvePLwPyD+j12/BqPIE=";
inherit (gen) url hash;
};
postInstall = ''
mkdir $out
cp -a ./* $out

View file

@ -0,0 +1,6 @@
# This file was autogenerated. DO NOT EDIT!
{
version = "2.7.2";
url = "https://github.com/VueTorrent/VueTorrent/releases/download/v2.7.2/vuetorrent.zip";
hash = "sha256-G7LkoQmTR9ilygPPrip+f/LnpEXaeWcb+xcBWIz98A8=";
}

View file

@ -55,15 +55,36 @@ updateFirefoxAddons() {
)
}
updateVuetorrent() {
FILE="$FLAKE/devices/nos/modules/qbittorrent/vuetorrent.nix"
release=$(curl -s https://api.github.com/repos/VueTorrent/VueTorrent/releases/latest)
version=$(echo "$release" | jq -r .tag_name | tr -d v)
url="https://github.com/VueTorrent/VueTorrent/releases/download/v${version}/vuetorrent.zip"
hash="$(nix store prefetch-file --refresh --json \
--hash-type sha256 "$url" --name "escaped" | jq -r .hash)"
{
echo '# This file was autogenerated. DO NOT EDIT!'
echo '{'
echo " version = \"$version\";"
echo " url = \"$url\";"
echo " hash = \"$hash\";"
echo '}'
} >"$FILE"
}
doAll() {
updateFFZ
updateFirefoxAddons
updateVuetorrent
}
[[ "$1" == "-a" || "$1" == "--all" ]] && doAll
[[ "$1" == "-f" || "$1" == "--firefox" ]] && updateFirefoxAddons
[[ "$1" == "-ffz" || "$1" == "--frankerfacez" ]] && updateFFZ
[[ "$1" == "-v" || "$1" == "--vuetorrent" ]] && updateVuetorrent
alejandra "$FLAKE"