diff --git a/pkgs/by-name/ho/hoppscotch/package.nix b/pkgs/by-name/ho/hoppscotch/package.nix index b89768148e9e..ce8fcd155d4c 100644 --- a/pkgs/by-name/ho/hoppscotch/package.nix +++ b/pkgs/by-name/ho/hoppscotch/package.nix @@ -8,25 +8,27 @@ let pname = "hoppscotch"; - version = "25.1.1-0"; + version = "25.3.2-0"; src = fetchurl { aarch64-darwin = { url = "https://github.com/hoppscotch/releases/releases/download/v${version}/Hoppscotch_mac_aarch64.dmg"; - hash = "sha256-1KYc96WUlybXhgPeT97w1mLE2zxmohIhvNMCmEb5Vf0="; + hash = "sha256-l8R6pWu8lJSuji8lITFJFUagvFUFbJ5KKUBJ/1jE9WI="; }; x86_64-darwin = { url = "https://github.com/hoppscotch/releases/releases/download/v${version}/Hoppscotch_mac_x64.dmg"; - hash = "sha256-wdqgzTXFL7Dvq1DOrjyPE4O3OYfpvmRSLzk+HBJIaTU="; + hash = "sha256-6HT2IwdjaMjf+PcN6/keCSIqKAIOsQqocEibA+v5GJc="; }; x86_64-linux = { url = "https://github.com/hoppscotch/releases/releases/download/v${version}/Hoppscotch_linux_x64.AppImage"; - hash = "sha256-M9fQx4NBotLPe8i43E1uqHpFeoXdHGQePp4zgzbzDdM="; + hash = "sha256-TpR0vfOba34C+BMi5Yn1C1M83gPXzRnqi1w0+Jt5GNc="; }; } - .${stdenv.system} or (throw "Unsupported system: ${stdenv.system}"); + .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); + + passthru.updateScript = ./update.sh; meta = { description = "Open source API development ecosystem"; @@ -56,6 +58,7 @@ if stdenv.hostPlatform.isDarwin then pname version src + passthru meta ; @@ -78,6 +81,7 @@ else pname version src + passthru meta ; @@ -87,7 +91,9 @@ else in '' # Install .desktop files - install -Dm444 ${appimageContents}/hoppscotch.desktop -t $out/share/applications - install -Dm444 ${appimageContents}/hoppscotch.png -t $out/share/pixmaps + install -Dm444 ${appimageContents}/Hoppscotch.desktop $out/share/applications/hoppscotch.desktop + install -Dm444 ${appimageContents}/Hoppscotch.png $out/share/pixmaps/hoppscotch.png + substituteInPlace $out/share/applications/hoppscotch.desktop \ + --replace-fail "hoppscotch-desktop" "hoppscotch" ''; } diff --git a/pkgs/by-name/ho/hoppscotch/update.sh b/pkgs/by-name/ho/hoppscotch/update.sh new file mode 100755 index 000000000000..aaa4fc97b59a --- /dev/null +++ b/pkgs/by-name/ho/hoppscotch/update.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p bash nix-update common-updater-scripts nix jq + +set -euo pipefail + +currentVersion=$(nix-instantiate --eval -E "with import ./. {}; hoppscotch.version or (lib.getVersion hoppscotch)" | tr -d '"') +latestVersion=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/hoppscotch/releases/releases/latest | jq --raw-output .tag_name | sed 's/^v//') + +if [[ "$currentVersion" == "$latestVersion" ]]; then + echo "package is up-to-date: $currentVersion" + exit 0 +fi + +update-source-version hoppscotch $latestVersion || true + +for system in \ + x86_64-linux \ + x86_64-darwin \ + aarch64-darwin; do + hash=$(nix hash convert --to sri --hash-algo sha256 $(nix-prefetch-url $(nix-instantiate --eval -E "with import ./. {}; hoppscotch.src.url" --system "$system" | tr -d '"'))) + update-source-version hoppscotch $latestVersion $hash --system=$system --ignore-same-version +done