diff --git a/pkgs/by-name/si/simplex-chat-desktop/package.nix b/pkgs/by-name/si/simplex-chat-desktop/package.nix index b2da687765b7..1c707c969b25 100644 --- a/pkgs/by-name/si/simplex-chat-desktop/package.nix +++ b/pkgs/by-name/si/simplex-chat-desktop/package.nix @@ -2,7 +2,6 @@ lib, appimageTools, fetchurl, - gitUpdater, stdenv, }: @@ -13,7 +12,7 @@ let sources = { "aarch64-linux" = fetchurl { url = "https://github.com/simplex-chat/simplex-chat/releases/download/v${version}/simplex-desktop-aarch64.AppImage"; - hash = "sha256-CvHwYKbieRYbBKUCoKAa11rTy5Opdfb7FKS4poantKs="; + hash = "sha256-VrPNKXgVO/9yvGqseOVkYKMFVqhtExL2PCJb6stn3ko="; }; "x86_64-linux" = fetchurl { url = "https://github.com/simplex-chat/simplex-chat/releases/download/v${version}/simplex-desktop-x86_64.AppImage"; @@ -46,11 +45,9 @@ appimageTools.wrapType2 { cp -r ${appimageContents}/usr/share/icons $out/share ''; - passthru.updateScript = gitUpdater { - url = "https://github.com/simplex-chat/simplex-chat"; - rev-prefix = "v"; - # skip tags that does not correspond to official releases, like vX.Y.Z-(beta,fdroid,armv7a). - ignoredVersions = "-"; + passthru = { + inherit sources; + updateScript = ./update.sh; }; meta = { diff --git a/pkgs/by-name/si/simplex-chat-desktop/update.sh b/pkgs/by-name/si/simplex-chat-desktop/update.sh new file mode 100755 index 000000000000..97bac9149d84 --- /dev/null +++ b/pkgs/by-name/si/simplex-chat-desktop/update.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl jq common-updater-scripts + +set -euo pipefail + +attr="simplex-chat-desktop" + +# Get the latest non-prerelease tag from GitHub. +latest=$(curl -fsSL ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} \ + "https://api.github.com/repos/simplex-chat/simplex-chat/releases/latest" \ + | jq -r '.tag_name') + +# Strip the leading "v". +version="${latest#v}" + +# Current version in nixpkgs (so we can short-circuit if unchanged). +current=$(nix-instantiate --eval -E "with import ./. {}; ${attr}.version" \ + | tr -d '"') + +if [[ "$version" == "$current" ]]; then + echo "${attr} is already at ${version}" + exit 0 +fi + +# Update each per-system source independently. +update-source-version "$attr" "$version" \ + --source-key=sources.x86_64-linux + +# --ignore-same-version flag silences warning because previous invocation bumped version +update-source-version "$attr" "$version" \ + --ignore-same-version \ + --source-key=sources.aarch64-linux