From 77514565aef4cc2bd8fab96949c34317f2c687a6 Mon Sep 17 00:00:00 2001 From: L-Trump Date: Mon, 21 Oct 2024 19:55:25 +0800 Subject: [PATCH 1/2] snipaste: 2.9.2-Beta -> 2.10.2 --- pkgs/by-name/sn/snipaste/package.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/sn/snipaste/package.nix b/pkgs/by-name/sn/snipaste/package.nix index 45b35d04d68e..ebdcd47936b5 100644 --- a/pkgs/by-name/sn/snipaste/package.nix +++ b/pkgs/by-name/sn/snipaste/package.nix @@ -5,18 +5,21 @@ }: appimageTools.wrapType2 rec { pname = "snipaste"; - version = "2.9.2-Beta"; + version = "2.10.2"; src = fetchurl { url = "https://download.snipaste.com/archives/Snipaste-${version}-x86_64.AppImage"; - hash = "sha256-oV69uABjzkbQdwb+1wRRxszhrwI4uyzhQZ4aXBnyeo8="; + hash = "sha256-u9e2d9ZpHDbDIsFkseOdJX2Kspn9TkhFfZxbeielDA8="; }; meta = { description = "Screenshot tools"; homepage = "https://www.snipaste.com/"; license = lib.licenses.unfree; - maintainers = with lib.maintainers; [ luftmensch-luftmensch ]; + maintainers = with lib.maintainers; [ + luftmensch-luftmensch + ltrump + ]; mainProgram = "snipaste"; platforms = [ "x86_64-linux" ]; sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; From 117bafd4d2e40cbfe0ce863bf5dec4e18c3fa379 Mon Sep 17 00:00:00 2001 From: L-Trump Date: Mon, 21 Oct 2024 19:56:07 +0800 Subject: [PATCH 2/2] snipaste: add updateScript --- pkgs/by-name/sn/snipaste/package.nix | 2 ++ pkgs/by-name/sn/snipaste/update.sh | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100755 pkgs/by-name/sn/snipaste/update.sh diff --git a/pkgs/by-name/sn/snipaste/package.nix b/pkgs/by-name/sn/snipaste/package.nix index ebdcd47936b5..12cf92be8f51 100644 --- a/pkgs/by-name/sn/snipaste/package.nix +++ b/pkgs/by-name/sn/snipaste/package.nix @@ -12,6 +12,8 @@ appimageTools.wrapType2 rec { hash = "sha256-u9e2d9ZpHDbDIsFkseOdJX2Kspn9TkhFfZxbeielDA8="; }; + passthru.updateScript = ./update.sh; + meta = { description = "Screenshot tools"; homepage = "https://www.snipaste.com/"; diff --git a/pkgs/by-name/sn/snipaste/update.sh b/pkgs/by-name/sn/snipaste/update.sh new file mode 100755 index 000000000000..1c6843fe6839 --- /dev/null +++ b/pkgs/by-name/sn/snipaste/update.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p bash curl coreutils jq common-updater-scripts + +latestTag=$(curl -sSfL https://www.snipaste.com/linux_version | jq -r ".subject") +latestVersion="$(expr "$latestTag" : 'v\(.*\)')" +currentVersion=$(nix-instantiate --eval -E "with import ./. {}; snipaste.version" | tr -d '"') + +if [[ "$latestVersion" == "$currentVersion" ]]; then + echo "package is up-to-date" + exit 0 +fi + +prefetch=$(nix-prefetch-url "https://download.snipaste.com/archives/Snipaste-$latestVersion-x86_64.AppImage") +hash=$(nix-hash --type sha256 --to-sri "$prefetch") +update-source-version snipaste "$latestVersion" "$hash" --ignore-same-version