Fix Cursor update crashes and keymapping issues on NixOS

This commit is contained in:
thinktankmachine
2025-08-07 08:56:41 +10:00
parent 035a280383
commit 32155ec2dc
2 changed files with 39 additions and 9 deletions
+24 -6
View File
@@ -1,13 +1,17 @@
{ config, pkgs, lib, ... }:
let
# Cursor 1.3.9 AppImage wrapper with enhanced compatibility
# Cursor 1.3.9 AppImage wrapper with enhanced compatibility and update handling
cursorAppImage = pkgs.writeShellScriptBin "cursor" ''
# Set up environment for better AppImage compatibility
export APPDIR=""
export ARGV0=""
export OWD=""
# Disable Cursor's auto-update mechanism to prevent crashes
export CURSOR_DISABLE_UPDATE="1"
export CURSOR_SKIP_UPDATE_CHECK="1"
# Ensure proper library paths
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [
pkgs.glib
@@ -32,13 +36,27 @@ let
pkgs.at-spi2-core
pkgs.mesa
pkgs.alsa-lib
pkgs.fuse
]}:$LD_LIBRARY_PATH"
# Run the AppImage with appimage-run
exec ${pkgs.appimage-run}/bin/appimage-run ${pkgs.fetchurl {
url = "https://downloads.cursor.com/production/54c27320fab08c9f5dd5873f07fca101f7a3e076/linux/x64/Cursor-1.3.9-x86_64.AppImage";
sha256 = "076ijp033xjg09aqjhjm6sslvq0hsjga35840m3br722lqpi6jfj";
}} "$@"
# Set additional environment variables to handle keymapping issues
export ELECTRON_DISABLE_SECURITY_WARNINGS="1"
export ELECTRON_NO_ATTACH_CONSOLE="1"
# Create a temporary directory for Cursor's cache to avoid permission issues
export CURSOR_CACHE_DIR="/tmp/cursor-cache-$$"
mkdir -p "$CURSOR_CACHE_DIR"
# Run the AppImage with appimage-run and additional flags
exec ${pkgs.appimage-run}/bin/appimage-run \
--no-sandbox \
${pkgs.fetchurl {
url = "https://downloads.cursor.com/production/54c27320fab08c9f5dd5873f07fca101f7a3e076/linux/x64/Cursor-1.3.9-x86_64.AppImage";
sha256 = "076ijp033xjg09aqjhjm6sslvq0hsjga35840m3br722lqpi6jfj";
}} \
--disable-updates \
--no-update-check \
"$@"
'';
in
{