Skip to content

Commit 6523e18

Browse files
authored
code-cursor: 0.41.1 -> 0.41.3 (#345366)
2 parents 5850333 + 6e83d2c commit 6523e18

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

pkgs/by-name/co/code-cursor/package.nix

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,15 @@
44
fetchurl,
55
appimageTools,
66
makeWrapper,
7-
writeShellApplication,
8-
curl,
9-
yq,
10-
common-updater-scripts,
7+
writeScript,
118
}:
129
let
1310
pname = "cursor";
14-
version = "0.41.1";
11+
version = "0.41.3";
1512
appKey = "230313mzl4w4u92";
1613
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=";
1916
};
2017
appimageContents = appimageTools.extractType2 { inherit version pname src; };
2118
in
@@ -46,23 +43,21 @@ stdenvNoCC.mkDerivation {
4643
runHook postInstall
4744
'';
4845

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+
'';
6661

6762
meta = {
6863
description = "AI-powered code editor built on vscode";

0 commit comments

Comments
 (0)