|
4 | 4 | fetchurl, |
5 | 5 | appimageTools, |
6 | 6 | makeWrapper, |
7 | | - writeShellApplication, |
8 | | - curl, |
9 | | - yq, |
10 | | - common-updater-scripts, |
| 7 | + writeScript, |
11 | 8 | }: |
12 | 9 | let |
13 | 10 | pname = "cursor"; |
14 | | - version = "0.41.1"; |
| 11 | + version = "0.41.3"; |
15 | 12 | appKey = "230313mzl4w4u92"; |
16 | 13 | src = fetchurl { |
17 | | - url = "https://download.todesktop.com/${appKey}/cursor-0.41.1-build-2409189xe3envg5-x86_64.AppImage"; |
18 | | - hash = "sha256-9zqktOR5UOMLkKLD1uJ8eNSujWnnyKAN9H8ejrgcfVU="; |
| 14 | + url = "https://download.todesktop.com/230313mzl4w4u92/cursor-0.41.3-build-240925fkhcqg263-x86_64.AppImage"; |
| 15 | + hash = "sha256-WtfyiNGnUn8g1HR0TQPyn3SMJmjqe+otAYeyokMIO+w="; |
19 | 16 | }; |
20 | 17 | appimageContents = appimageTools.extractType2 { inherit version pname src; }; |
21 | 18 | in |
@@ -46,23 +43,21 @@ stdenvNoCC.mkDerivation { |
46 | 43 | runHook postInstall |
47 | 44 | ''; |
48 | 45 |
|
49 | | - passthru = { |
50 | | - updateScript = lib.getExe (writeShellApplication { |
51 | | - name = "update-cursor"; |
52 | | - runtimeInputs = [ |
53 | | - curl |
54 | | - yq |
55 | | - common-updater-scripts |
56 | | - ]; |
57 | | - text = '' |
58 | | - set -o errexit |
59 | | - latestLinux="$(curl -s https://download.todesktop.com/${appKey}/latest-linux.yml)" |
60 | | - version="$(echo "$latestLinux" | yq -r .version)" |
61 | | - filename="$(echo "$latestLinux" | yq -r '.files[] | .url | select(. | endswith(".AppImage"))')" |
62 | | - update-source-version code-cursor "$version" "" "https://download.todesktop.com/${appKey}/$filename" --source-key=src.src |
63 | | - ''; |
64 | | - }); |
65 | | - }; |
| 46 | + passthru.updateScript = writeScript "update.sh" '' |
| 47 | + #!/usr/bin/env nix-shell |
| 48 | + #!nix-shell -i bash -p curl yq coreutils gnused common-updater-scripts |
| 49 | + set -eu -o pipefail |
| 50 | + latestLinux="$(curl -s https://download.todesktop.com/${appKey}/latest-linux.yml)" |
| 51 | + version="$(echo "$latestLinux" | yq -r .version)" |
| 52 | + filename="$(echo "$latestLinux" | yq -r '.files[] | .url | select(. | endswith(".AppImage"))')" |
| 53 | + url="https://download.todesktop.com/${appKey}/$filename" |
| 54 | + currentVersion=$(nix-instantiate --eval -E "with import ./. {}; code-cursor.version or (lib.getVersion code-cursor)" | tr -d '"') |
| 55 | +
|
| 56 | + if [[ "$version" != "$currentVersion" ]]; then |
| 57 | + hash=$(nix-hash --to-sri --type sha256 "$(nix-prefetch-url "$url")") |
| 58 | + update-source-version code-cursor "$version" "$hash" "$url" --source-key=src.src |
| 59 | + fi |
| 60 | + ''; |
66 | 61 |
|
67 | 62 | meta = { |
68 | 63 | description = "AI-powered code editor built on vscode"; |
|
0 commit comments