diff --git a/devices/nos/modules/qbittorrent/qbittorrent.nix b/devices/nos/modules/qbittorrent/qbittorrent.nix index 1d2d1b1..4b6a64f 100644 --- a/devices/nos/modules/qbittorrent/qbittorrent.nix +++ b/devices/nos/modules/qbittorrent/qbittorrent.nix @@ -7,19 +7,23 @@ cfg = config.services.qbittorrent; pkg = pkgs.qbittorrent-nox; - vue = pkgs.stdenv.mkDerivation { - name = "vuetorrent"; - 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="; + vue = let + gen = import ./vuetorrent.nix; + in + pkgs.stdenv.mkDerivation { + name = "vuetorrent"; + inherit (gen) version; + + nativeBuildInputs = [pkgs.unzip]; + src = pkgs.fetchurl { + inherit (gen) url hash; + }; + + postInstall = '' + mkdir $out + cp -a ./* $out + ''; }; - postInstall = '' - mkdir $out - cp -a ./* $out - ''; - }; inherit (lib) diff --git a/devices/nos/modules/qbittorrent/vuetorrent.nix b/devices/nos/modules/qbittorrent/vuetorrent.nix new file mode 100644 index 0000000..65d48c8 --- /dev/null +++ b/devices/nos/modules/qbittorrent/vuetorrent.nix @@ -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="; +} diff --git a/updateSha.sh b/updateSha.sh index 7a23027..1b01196 100755 --- a/updateSha.sh +++ b/updateSha.sh @@ -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"