packages(showdex): add updateScript

Unfortunately it seems non-trivial to get nix-update to work with update
scripts outside of nixpkgs however I could write a script to automate
updating all packages in the future.
This commit is contained in:
Donovan Glover 2024-10-13 14:37:41 -04:00
parent a0acb050d0
commit f70f6c305d
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -23,6 +23,16 @@ stdenvNoCC.mkDerivation (finalAttrs: {
runHook postInstall
'';
passthru.updateScript = # fish
''
set URL $(curl -s https://api.github.com/repos/doshidak/showdex/releases/latest | jq -r ".assets[] | select(.content_type == \"application/x-xpinstall\") | .browser_download_url")
and set VERSION $(echo "$URL" | grep -Eo '[0-9\.]+-+b[A-Z0-9]+')
and set HASH $(nix hash convert --to sri sha256:$(nix-prefetch-url "$URL"))
and sd -n 1 'version = "[^"]*"' "version = \"$VERSION\"" ./packages/showdex.nix
and sd -n 1 'hash = "[^"]*"' "hash = \"$HASH\"" ./packages/showdex.nix
'';
meta = {
homepage = "https://github.com/doshidak/showdex";
description = "Pokémon Showdown extension that harnesses the power of parabolic calculus to strategically extract your opponents' Elo";