From 4edf9b117c61e4eabaedea21dd87283fa76f67e5 Mon Sep 17 00:00:00 2001 From: StepBroBD Date: Wed, 5 Apr 2023 14:31:57 -0600 Subject: [PATCH] raycast: 1.49.0 -> 1.49.2 --- pkgs/os-specific/darwin/raycast/default.nix | 4 ++-- pkgs/os-specific/darwin/raycast/update.sh | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100755 pkgs/os-specific/darwin/raycast/update.sh diff --git a/pkgs/os-specific/darwin/raycast/default.nix b/pkgs/os-specific/darwin/raycast/default.nix index ea635312d1f2..99eb18a992ec 100644 --- a/pkgs/os-specific/darwin/raycast/default.nix +++ b/pkgs/os-specific/darwin/raycast/default.nix @@ -6,7 +6,7 @@ stdenvNoCC.mkDerivation rec { pname = "raycast"; - version = "1.49.0"; + version = "1.49.2"; src = fetchurl { # https://github.com/NixOS/nixpkgs/pull/223495 @@ -17,7 +17,7 @@ stdenvNoCC.mkDerivation rec { # to host GitHub Actions to periodically check for updates # and re-release the `.dmg` file to Internet Archive (https://archive.org/details/raycast) url = "https://archive.org/download/raycast/raycast-${version}.dmg"; - sha256 = "sha256-6j5PyzJ7g3p+5gE2CQHlZrLj5b3rLdpodl+By7xxcjo="; + sha256 = "sha256-3evuSRSCZkhxRy/85ohzIVF1tKRlWy+G5BOmuCWF2hU="; }; dontPatch = true; diff --git a/pkgs/os-specific/darwin/raycast/update.sh b/pkgs/os-specific/darwin/raycast/update.sh new file mode 100755 index 000000000000..d8f4e109da21 --- /dev/null +++ b/pkgs/os-specific/darwin/raycast/update.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env nix-shell +#!nix-shell -I nixpkgs=../../../../. -i bash -p common-updater-scripts internetarchive + +set -eo pipefail + +new_version="$(ia list raycast | grep -Eo '^raycast-.*\.dmg$' | sort -r | head -n1 | sed -E 's/^raycast-([0-9]+\.[0-9]+\.[0-9]+)\.dmg$/\1/')" +old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)" + +if [[ "$new_version" == "$old_version" ]]; then + echo "Already up to date." + exit 0 +else + echo "raycast: $old_version -> $new_version" + sed -Ei.bak '/ *version = "/s/".+"/"'"$new_version"'"/' ./default.nix + rm ./default.nix.bak +fi + +hash="$(nix --extra-experimental-features nix-command store prefetch-file --json --hash-type sha256 "https://archive.org/download/raycast/raycast-$new_version.dmg" | jq -r '.hash')" +sed -Ei.bak '/ *sha256 = /{N;N; s@("sha256-)[^;"]+@"'"$hash"'@}' ./default.nix +rm ./default.nix.bak