Files
vomba f202e64382 code-cursor: 3.9.16 -> 3.11.13
https://cursor.com/changelog

Cap build-time vscodeVersion for ripgrep path selection so the
notarized macOS app bundle is not modified during the build.

Assisted-by: Cursor (Composer)
2026-07-11 15:24:05 +02:00

110 lines
3.0 KiB
Nix

{
lib,
stdenv,
buildVscode,
fetchurl,
appimageTools,
undmg,
commandLineArgs ? "",
useVSCodeRipgrep ? stdenv.hostPlatform.isDarwin,
}:
let
inherit (stdenv) hostPlatform;
sourcesJson = lib.importJSON ./sources.json;
sources = lib.mapAttrs (
_: info:
fetchurl {
inherit (info) url hash;
}
) sourcesJson.sources;
source = sources.${hostPlatform.system};
in
(buildVscode rec {
inherit commandLineArgs useVSCodeRipgrep;
inherit (sourcesJson) version;
# Cursor reports vscode >= 1.122 but still ships @vscode/ripgrep.
# Capping the build-time vscodeVersion avoids modifying the notarized app bundle on Darwin.
vscodeVersion =
if lib.versionAtLeast sourcesJson.vscodeVersion "1.122.0" then
"1.121.0"
else
sourcesJson.vscodeVersion;
pname = "cursor";
executableName = "cursor";
longName = "Cursor";
shortName = "cursor";
libraryName = "cursor";
iconName = "cursor";
src =
if hostPlatform.isLinux then
appimageTools.extract {
inherit pname version;
src = source;
}
else
source;
# for unpacking the DMG
extraNativeBuildInputs = lib.optionals hostPlatform.isDarwin [ undmg ];
sourceRoot =
if hostPlatform.isLinux then "${pname}-${version}-extracted/usr/share/cursor" else "Cursor.app";
tests = { };
updateScript = ./update.sh;
# Editing the `cursor` binary within the app bundle causes the bundle's signature
# to be invalidated, which prevents launching starting with macOS Ventura, because Cursor is notarized.
# See https://eclecticlight.co/2022/06/17/app-security-changes-coming-in-ventura/ for more information.
dontFixup = stdenv.hostPlatform.isDarwin;
# Cursor ships a launcher script that resolves its own VSCODE_PATH.
patchVSCodePath = false;
meta = {
description = "AI-powered code editor built on vscode";
homepage = "https://cursor.com";
changelog = "https://cursor.com/changelog";
license = lib.licenses.unfree;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
maintainers = with lib.maintainers; [
aspauldingcode
prince213
qweered
];
platforms = [
"aarch64-linux"
"x86_64-linux"
]
++ lib.platforms.darwin;
mainProgram = "cursor";
};
}).overrideAttrs
(oldAttrs: {
autoPatchelfIgnoreMissingDeps =
(oldAttrs.autoPatchelfIgnoreMissingDeps or [ ])
++ lib.optionals (stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isMusl) [
"libc.musl-*.so.*" # musl-based node modules are not used on glibc systems
];
preFixup =
(oldAttrs.preFixup or "")
+ lib.optionalString hostPlatform.isLinux ''
sed -i '/^Keywords=/a MimeType=application/x-cursor-workspace;' \
$out/share/applications/cursor.desktop
'';
postInstall =
(oldAttrs.postInstall or "")
+ lib.optionalString hostPlatform.isLinux ''
install -Dm644 ../mime/packages/cursor-workspace.xml -t $out/share/mime/packages
rm -f $out/lib/cursor/resources/appimageupdatetool.AppImage
'';
})