nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 fetchurl,
5 writeShellApplication,
6 cacert,
7 curl,
8 jq,
9 openssl,
10 undmg,
11}:
12
13stdenvNoCC.mkDerivation (finalAttrs: {
14 pname = "raycast";
15 version = "1.102.0";
16
17 src =
18 {
19 aarch64-darwin = fetchurl {
20 name = "Raycast.dmg";
21 url = "https://releases.raycast.com/releases/${finalAttrs.version}/download?build=arm";
22 hash = "sha256-f26Tf59ow7rJiL+2BRgDhbEpWB2z4JaRUsT9UMxKjV4=";
23 };
24 x86_64-darwin = fetchurl {
25 name = "Raycast.dmg";
26 url = "https://releases.raycast.com/releases/${finalAttrs.version}/download?build=x86_64";
27 hash = "sha256-Ict34LSjpN1Ah/uOclRi0xQfO6oQgmP57K+12bIjW6k=";
28 };
29 }
30 .${stdenvNoCC.system} or (throw "raycast: ${stdenvNoCC.system} is unsupported.");
31
32 dontPatch = true;
33 dontConfigure = true;
34 dontBuild = true;
35 dontFixup = true;
36
37 nativeBuildInputs = [ undmg ];
38
39 sourceRoot = "Raycast.app";
40
41 installPhase = ''
42 runHook preInstall
43
44 mkdir -p $out/Applications/Raycast.app
45 cp -R . $out/Applications/Raycast.app
46
47 runHook postInstall
48 '';
49
50 passthru.updateScript = lib.getExe (writeShellApplication {
51 name = "raycast-update-script";
52 runtimeInputs = [
53 cacert
54 curl
55 jq
56 openssl
57 ];
58 text = ''
59 url=$(curl --silent "https://releases.raycast.com/releases/latest?build=universal")
60 version=$(echo "$url" | jq -r '.version')
61
62 arm_url="https://releases.raycast.com/releases/$version/download?build=arm"
63 x86_url="https://releases.raycast.com/releases/$version/download?build=x86_64"
64
65 arm_hash="sha256-$(curl -sL "$arm_url" | openssl dgst -sha256 -binary | openssl base64)"
66 x86_hash="sha256-$(curl -sL "$x86_url" | openssl dgst -sha256 -binary | openssl base64)"
67
68 sed -i -E \
69 -e 's|(version = )"[0-9]+\.[0-9]+\.[0-9]+";|\1"'"$version"'";|' \
70 -e '/aarch64-darwin = fetchurl/,/};/ s|(hash = )"sha256-[A-Za-z0-9+/]+=";|\1"'"$arm_hash"'";|' \
71 -e '/x86_64-darwin = fetchurl/,/};/ s|(hash = )"sha256-[A-Za-z0-9+/]+=";|\1"'"$x86_hash"'";|' \
72 ./pkgs/by-name/ra/raycast/package.nix
73 '';
74 });
75
76 meta = {
77 description = "Control your tools with a few keystrokes";
78 homepage = "https://raycast.app/";
79 license = lib.licenses.unfree;
80 maintainers = with lib.maintainers; [
81 lovesegfault
82 stepbrobd
83 donteatoreo
84 jakecleary
85 ];
86 platforms = [
87 "aarch64-darwin"
88 "x86_64-darwin"
89 ];
90 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
91 };
92})