Merge pull request #237960 from StepBroBD/raycast

This commit is contained in:
Bernardo Meurer 2023-06-16 07:57:08 -04:00 committed by GitHub
commit 74d4119976
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 14 deletions

View file

@ -6,18 +6,12 @@
stdenvNoCC.mkDerivation rec {
pname = "raycast";
version = "1.53.2";
version = "1.53.3";
src = fetchurl {
# https://github.com/NixOS/nixpkgs/pull/223495
# official download API: https://api.raycast.app/v2/download
# this returns an AWS CloudFront signed URL with expiration timestamp and signature
# the returned URL will always be the latest Raycast which might result in an impure derivation
# the package maintainer created a repo (https://github.com/stepbrobd/raycast-overlay)
# 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-e2UGS1LSBj0xZu0gWlb8SiXhx1sZzcZDOGPhg6ziI9c=";
name = "Raycast.dmg";
url = "https://releases.raycast.com/releases/${version}/download?build=universal";
sha256 = "sha256-FHCNySTtP7Dxa2UAlYoHD4u5ammLuhOQKC3NGpxcyYo=";
};
dontPatch = true;

View file

@ -3,10 +3,10 @@
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)"
new_version=$(curl --silent https://releases.raycast.com/releases/latest | jq -r '.version')
old_version=$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)
if [[ "$new_version" == "$old_version" ]]; then
if [[ $new_version == $old_version ]]; then
echo "Already up to date."
exit 0
else
@ -15,6 +15,6 @@ else
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')"
hash=$(nix --extra-experimental-features nix-command store prefetch-file --json --hash-type sha256 "https://releases.raycast.com/releases/$new_version/download?build=universal" | jq -r '.hash')
sed -Ei.bak '/ *sha256 = /{N;N; s@("sha256-)[^;"]+@"'"$hash"'@}' ./default.nix
rm ./default.nix.bak