-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpackage.nix
More file actions
172 lines (159 loc) · 4.57 KB
/
package.nix
File metadata and controls
172 lines (159 loc) · 4.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
{
lib,
stdenv,
fetchurl,
appimageTools,
makeWrapper,
undmg,
google-chrome,
# Additional libraries for Electron/webview support
libxkbfile,
libsecret,
libGL,
libdrm,
mesa,
nss,
nspr,
at-spi2-atk,
at-spi2-core,
libxkbcommon,
xorg,
wayland,
gtk3,
glib,
pango,
cairo,
gdk-pixbuf,
libnotify,
cups,
libpulseaudio,
systemd,
}:
let
pname = "cursor";
version = "3.1.17";
sources = {
x86_64-linux = fetchurl {
url = "https://downloads.cursor.com/production/fce1e9ab7844f9ea35793da01e634aa7e50bce90/linux/x64/Cursor-${version}-x86_64.AppImage";
hash = "sha256-+Pk5MvQSjhoKJdtN+pWX/vcyWnHmbXvJ5wFDvgtHo20=";
};
aarch64-linux = fetchurl {
url = "https://downloads.cursor.com/production/3a67af7b780e0bfc8d32aefa96b8ff1cb8817f88/linux/arm64/Cursor-${version}-aarch64.AppImage";
hash = "sha256-kZf4qmOdtp3HFe/L6yehZ0cg5DklJwg+Lmnlhn6KBRM=";
};
x86_64-darwin = fetchurl {
url = "https://downloads.cursor.com/production/3a67af7b780e0bfc8d32aefa96b8ff1cb8817f88/darwin/x64/Cursor-darwin-x64.dmg";
hash = "sha256-GIBT7DU+J/hQ/qbDUdgRrO24z66JASQlfRpVFBsCiw0=";
};
aarch64-darwin = fetchurl {
url = "https://downloads.cursor.com/production/3a67af7b780e0bfc8d32aefa96b8ff1cb8817f88/darwin/arm64/Cursor-darwin-arm64.dmg";
hash = "sha256-NouEzXpKO2A3/y8FCNTXspm+Rim6a5Yi1yS1kLeevi8=";
};
};
source = sources.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
appimageContents = appimageTools.extractType2 {
inherit pname version;
src = source;
};
in
if stdenv.hostPlatform.isLinux then
appimageTools.wrapType2 {
inherit pname version;
src = source;
# Include Chrome and essential Electron/webview libraries in FHS environment
extraPkgs = pkgs: [
google-chrome
# Keyboard/input handling (fixes native-keymap errors)
libxkbfile
libxkbcommon
xorg.libxkbfile
# Security/credentials
libsecret
nss
nspr
# Graphics/GPU
libGL
libdrm
mesa
# GTK/display
gtk3
glib
pango
cairo
gdk-pixbuf
# Accessibility (needed for BrowserView)
at-spi2-atk
at-spi2-core
# Wayland support
wayland
# System integration
libnotify
cups
libpulseaudio
systemd
# X11 libraries
xorg.libX11
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXrandr
xorg.libxcb
];
# Ensure Chrome is accessible with standard names
extraBwrapArgs = [
"--setenv CHROME_BIN ${google-chrome}/bin/google-chrome-stable"
"--setenv CHROME_PATH ${google-chrome}/bin/google-chrome-stable"
];
extraInstallCommands = ''
# Install desktop file and icons
install -Dm444 ${appimageContents}/cursor.desktop -t $out/share/applications
substituteInPlace $out/share/applications/cursor.desktop \
--replace-fail 'Exec=cursor' 'Exec=${pname}'
# Copy icon files
for size in 16 32 48 64 128 256 512 1024; do
if [ -f ${appimageContents}/usr/share/icons/hicolor/''${size}x''${size}/apps/cursor.png ]; then
install -Dm444 ${appimageContents}/usr/share/icons/hicolor/''${size}x''${size}/apps/cursor.png \
$out/share/icons/hicolor/''${size}x''${size}/apps/cursor.png
fi
done
'';
meta = with lib; {
description = "AI-powered code editor built on VS Code";
homepage = "https://cursor.com";
changelog = "https://www.cursor.com/changelog";
license = licenses.unfree;
maintainers = [ ];
platforms = [
"x86_64-linux"
"aarch64-linux"
];
mainProgram = "cursor";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
}
else if stdenv.hostPlatform.isDarwin then
stdenv.mkDerivation {
inherit pname version;
src = source;
nativeBuildInputs = [ undmg ];
sourceRoot = "Cursor.app";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications/Cursor.app
cp -R . $out/Applications/Cursor.app
runHook postInstall
'';
meta = with lib; {
description = "AI-powered code editor built on VS Code";
homepage = "https://cursor.com";
changelog = "https://www.cursor.com/changelog";
license = licenses.unfree;
maintainers = [ ];
platforms = lib.platforms.darwin;
mainProgram = "cursor";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
}
else
throw "Unsupported platform: ${stdenv.hostPlatform.system}"