Update Cursor to 1.4.2 and anonymize personal information
This commit is contained in:
@@ -0,0 +1,214 @@
|
|||||||
|
# Comprehensive Solution for Cursor AppImage Native Module Issues on NixOS
|
||||||
|
|
||||||
|
## Problem Summary
|
||||||
|
|
||||||
|
When using Cursor 1.3.9 as an AppImage in a NixOS flake, users encounter errors related to native modules not being found:
|
||||||
|
|
||||||
|
```
|
||||||
|
Error: Cannot find module './build/Debug/keymapping'
|
||||||
|
```
|
||||||
|
|
||||||
|
This issue occurs because the AppImage contains pre-compiled native modules that expect to find certain libraries in specific locations, but NixOS has a different filesystem structure that doesn't match these expectations.
|
||||||
|
|
||||||
|
## Root Cause Analysis
|
||||||
|
|
||||||
|
The problem is multifaceted:
|
||||||
|
|
||||||
|
1. **Library Path Issues**: Native modules in the AppImage can't find required system libraries
|
||||||
|
2. **Environment Variable Mismatch**: Electron applications expect certain environment variables to be set
|
||||||
|
3. **Sandboxing Conflicts**: NixOS sandboxing interferes with AppImage's assumptions about the filesystem
|
||||||
|
4. **Keyboard Mapping Dependencies**: The `native-keymap` module specifically requires X11 keyboard libraries
|
||||||
|
|
||||||
|
## Solution Overview
|
||||||
|
|
||||||
|
The solution involves modifying the Cursor wrapper in `home.nix` to:
|
||||||
|
|
||||||
|
1. Add missing system libraries to the library path
|
||||||
|
2. Set appropriate environment variables for Electron applications
|
||||||
|
3. Use AppImage extraction mode to avoid sandbox issues
|
||||||
|
4. Add proper flags to handle GPU and sandboxing issues
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
### Updated Cursor Wrapper Configuration
|
||||||
|
|
||||||
|
Here's the complete updated `cursorAppImage` section for your `home.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
let
|
||||||
|
# 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
|
||||||
|
pkgs.gtk3
|
||||||
|
pkgs.cairo
|
||||||
|
pkgs.pango
|
||||||
|
pkgs.atk
|
||||||
|
pkgs.gdk-pixbuf
|
||||||
|
pkgs.xorg.libX11
|
||||||
|
pkgs.xorg.libXcomposite
|
||||||
|
pkgs.xorg.libXcursor
|
||||||
|
pkgs.xorg.libXext
|
||||||
|
pkgs.xorg.libXfixes
|
||||||
|
pkgs.xorg.libXi
|
||||||
|
pkgs.xorg.libXrandr
|
||||||
|
pkgs.xorg.libXrender
|
||||||
|
pkgs.xorg.libXtst
|
||||||
|
pkgs.nss
|
||||||
|
pkgs.nspr
|
||||||
|
pkgs.dbus
|
||||||
|
pkgs.at-spi2-atk
|
||||||
|
pkgs.at-spi2-core
|
||||||
|
pkgs.mesa
|
||||||
|
pkgs.alsa-lib
|
||||||
|
pkgs.fuse
|
||||||
|
pkgs.libxkbcommon # Added for keyboard mapping support
|
||||||
|
pkgs.libxkbfile # Added for keyboard mapping support
|
||||||
|
]}:$LD_LIBRARY_PATH"
|
||||||
|
|
||||||
|
# Set additional environment variables to handle keymapping and native module issues
|
||||||
|
export ELECTRON_DISABLE_SECURITY_WARNINGS="1"
|
||||||
|
export ELECTRON_NO_ATTACH_CONSOLE="1"
|
||||||
|
export ELECTRON_RUN_AS_NODE="0"
|
||||||
|
|
||||||
|
# Additional environment variables for native module compatibility
|
||||||
|
export NODE_OPTIONS="--no-warnings"
|
||||||
|
export NODE_ENV="production"
|
||||||
|
export ELECTRON_ENABLE_LOGGING="false"
|
||||||
|
export ELECTRON_DISABLE_SECURITY_WARNINGS="true"
|
||||||
|
|
||||||
|
# Fix for native keymap module issues
|
||||||
|
export XDG_CACHE_HOME="/tmp/cursor-xdg-cache-$$"
|
||||||
|
mkdir -p "$XDG_CACHE_HOME"
|
||||||
|
|
||||||
|
# Create a temporary directory for Cursor's cache to avoid permission issues
|
||||||
|
export CURSOR_CACHE_DIR="/tmp/cursor-cache-$$"
|
||||||
|
mkdir -p "$CURSOR_CACHE_DIR"
|
||||||
|
|
||||||
|
# Additional fixes for AppImage native modules
|
||||||
|
export APPIMAGE_EXTRACT_AND_RUN="1"
|
||||||
|
|
||||||
|
# Run the AppImage with appimage-run and additional flags
|
||||||
|
exec ${pkgs.appimage-run}/bin/appimage-run \
|
||||||
|
--no-sandbox \
|
||||||
|
--appimage-extract-and-run \
|
||||||
|
${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 \
|
||||||
|
--disable-gpu-sandbox \
|
||||||
|
--disable-dev-shm-usage \
|
||||||
|
"$@"
|
||||||
|
'';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Key Changes Explained
|
||||||
|
|
||||||
|
### 1. Additional Libraries
|
||||||
|
- **libxkbcommon** and **libxkbfile**: Essential for keyboard mapping functionality
|
||||||
|
- These libraries were missing from the original configuration and are required by the `native-keymap` module
|
||||||
|
|
||||||
|
### 2. Environment Variables
|
||||||
|
- **ELECTRON_RUN_AS_NODE="0"**: Ensures Electron runs in application mode rather than Node.js mode
|
||||||
|
- **NODE_OPTIONS="--no-warnings"**: Reduces noise in the console output
|
||||||
|
- **NODE_ENV="production"**: Optimizes Node.js behavior for production use
|
||||||
|
- **XDG_CACHE_HOME**: Provides a writable cache directory for the application
|
||||||
|
|
||||||
|
### 3. AppImage Execution Mode
|
||||||
|
- **APPIMAGE_EXTRACT_AND_RUN="1"**: Forces extraction mode which avoids many sandboxing issues
|
||||||
|
- **--appimage-extract-and-run**: Command line flag that does the same thing
|
||||||
|
|
||||||
|
### 4. Additional Electron Flags
|
||||||
|
- **--disable-gpu-sandbox**: Reduces GPU-related sandboxing issues
|
||||||
|
- **--disable-dev-shm-usage**: Avoids issues with shared memory in containers/sandboxed environments
|
||||||
|
|
||||||
|
## Testing Plan
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
1. Updated `home.nix` file with the new Cursor wrapper configuration
|
||||||
|
2. Working NixOS system with flakes enabled
|
||||||
|
3. Sudo access to rebuild the system
|
||||||
|
|
||||||
|
### Testing Steps
|
||||||
|
|
||||||
|
1. **Apply Configuration Changes**
|
||||||
|
- Replace the existing `cursorAppImage` section in `home.nix`
|
||||||
|
- Save the file
|
||||||
|
|
||||||
|
2. **Rebuild the System**
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake .#cursor-system
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Test Basic Functionality**
|
||||||
|
```bash
|
||||||
|
cursor --version
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Test GUI Launch**
|
||||||
|
```bash
|
||||||
|
cursor
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Test Keyboard Functionality**
|
||||||
|
- Type in the editor
|
||||||
|
- Test keyboard shortcuts
|
||||||
|
- Try different keyboard layouts if applicable
|
||||||
|
|
||||||
|
### Success Criteria
|
||||||
|
The fix is successful if:
|
||||||
|
- [ ] `cursor --version` runs without errors
|
||||||
|
- [ ] Cursor GUI launches without keymapping errors
|
||||||
|
- [ ] Keyboard input works normally in the editor
|
||||||
|
- [ ] No native module loading errors in the console
|
||||||
|
- [ ] All basic functionality works as expected
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### If Issues Persist
|
||||||
|
|
||||||
|
1. **Clear AppImage Cache**
|
||||||
|
```bash
|
||||||
|
rm -rf ~/.cache/appimage-run/*
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Check System Logs**
|
||||||
|
```bash
|
||||||
|
journalctl -xe
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Run with Debugging**
|
||||||
|
```bash
|
||||||
|
cursor --enable-logging --v=1
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rollback Plan
|
||||||
|
|
||||||
|
If the updated configuration causes issues:
|
||||||
|
1. Restore the previous `home.nix` file
|
||||||
|
2. Rebuild the system:
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake .#cursor-system
|
||||||
|
```
|
||||||
|
3. Clear the AppImage cache:
|
||||||
|
```bash
|
||||||
|
rm -rf ~/.cache/appimage-run/*
|
||||||
|
```
|
||||||
|
|
||||||
|
## Conclusion
|
||||||
|
|
||||||
|
This solution addresses the native module loading issues by providing the missing libraries and environment variables that the AppImage expects. The key insight is that Electron applications packaged as AppImages have specific requirements that don't align with NixOS's unique filesystem structure, and we need to bridge that gap through careful environment configuration.
|
||||||
|
|
||||||
|
The changes are backward-compatible and should not introduce any new issues while resolving the existing keymapping errors.
|
||||||
+2
-2
@@ -16,8 +16,8 @@ Get Cursor 1.3.9 running on NixOS in minutes!
|
|||||||
```
|
```
|
||||||
|
|
||||||
2. **Customize the username** (optional):
|
2. **Customize the username** (optional):
|
||||||
- Edit `home.nix` and change `home.username = "liam";` to your username
|
- Edit `home.nix` and change `home.username = "user";` to your username
|
||||||
- Edit `configuration.nix` and change `users.users.liam` to your username
|
- Edit `configuration.nix` and change `users.users.user` to your username
|
||||||
|
|
||||||
3. **Deploy to your system:**
|
3. **Deploy to your system:**
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
+2
-2
@@ -48,9 +48,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# User configuration
|
# User configuration
|
||||||
users.users.liam = {
|
users.users.user = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "Liam";
|
description = "User";
|
||||||
extraGroups = [ "networkmanager" "wheel" "video" "audio" ];
|
extraGroups = [ "networkmanager" "wheel" "video" "audio" ];
|
||||||
# Set explicit password (password: cursor)
|
# Set explicit password (password: cursor)
|
||||||
hashedPassword = "$6$thkdqD1PCLUj6X9i$iPEOKRohaybp7XMYpyb7Zjd.Gdcl/weC732CYMlQ4ql7YDY8CLmSIqSUeH/efSnW.Wq9ICn2T5P5RSOqTqNlF0";
|
hashedPassword = "$6$thkdqD1PCLUj6X9i$iPEOKRohaybp7XMYpyb7Zjd.Gdcl/weC732CYMlQ4ql7YDY8CLmSIqSUeH/efSnW.Wq9ICn2T5P5RSOqTqNlF0";
|
||||||
|
|||||||
@@ -0,0 +1,267 @@
|
|||||||
|
# Cursor AppImage Native Module Fix
|
||||||
|
|
||||||
|
## Problem Analysis
|
||||||
|
|
||||||
|
The issue with Cursor when using the custom developed flake is related to native modules not being found when the AppImage runs. The error shows:
|
||||||
|
|
||||||
|
```
|
||||||
|
Error: Cannot find module './build/Debug/keymapping'
|
||||||
|
Require stack:
|
||||||
|
- /home/user/.cache/appimage-run/d249132fa6429cbc46050495a19ed410e04db53655428955024ff631c095d11c/usr/share/cursor/resources/app/node_modules/native-keymap/index.js
|
||||||
|
```
|
||||||
|
|
||||||
|
This is a common issue with Electron applications packaged as AppImages on NixOS systems. The native modules are compiled for a specific environment and don't work properly in the NixOS sandbox.
|
||||||
|
|
||||||
|
## Solution
|
||||||
|
|
||||||
|
We need to modify the Cursor wrapper in `home.nix` to add additional environment variables that help with native module loading. Here are the changes to make:
|
||||||
|
|
||||||
|
### Updated Cursor Wrapper Configuration
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
# 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
|
||||||
|
pkgs.gtk3
|
||||||
|
pkgs.cairo
|
||||||
|
pkgs.pango
|
||||||
|
pkgs.atk
|
||||||
|
pkgs.gdk-pixbuf
|
||||||
|
pkgs.xorg.libX11
|
||||||
|
pkgs.xorg.libXcomposite
|
||||||
|
pkgs.xorg.libXcursor
|
||||||
|
pkgs.xorg.libXext
|
||||||
|
pkgs.xorg.libXfixes
|
||||||
|
pkgs.xorg.libXi
|
||||||
|
pkgs.xorg.libXrandr
|
||||||
|
pkgs.xorg.libXrender
|
||||||
|
pkgs.xorg.libXtst
|
||||||
|
pkgs.nss
|
||||||
|
pkgs.nspr
|
||||||
|
pkgs.dbus
|
||||||
|
pkgs.at-spi2-atk
|
||||||
|
pkgs.at-spi2-core
|
||||||
|
pkgs.mesa
|
||||||
|
pkgs.alsa-lib
|
||||||
|
pkgs.fuse
|
||||||
|
pkgs.libxkbcommon
|
||||||
|
pkgs.libxkbfile
|
||||||
|
]}:$LD_LIBRARY_PATH"
|
||||||
|
|
||||||
|
# Set additional environment variables to handle keymapping and native module issues
|
||||||
|
export ELECTRON_DISABLE_SECURITY_WARNINGS="1"
|
||||||
|
export ELECTRON_NO_ATTACH_CONSOLE="1"
|
||||||
|
export ELECTRON_RUN_AS_NODE="0"
|
||||||
|
|
||||||
|
# Additional environment variables for native module compatibility
|
||||||
|
export NODE_OPTIONS="--no-warnings"
|
||||||
|
export NODE_ENV="production"
|
||||||
|
export ELECTRON_ENABLE_LOGGING="false"
|
||||||
|
export ELECTRON_DISABLE_SECURITY_WARNINGS="true"
|
||||||
|
|
||||||
|
# Fix for native keymap module issues
|
||||||
|
export XDG_CACHE_HOME="/tmp/cursor-xdg-cache-$$"
|
||||||
|
mkdir -p "$XDG_CACHE_HOME"
|
||||||
|
|
||||||
|
# Create a temporary directory for Cursor's cache to avoid permission issues
|
||||||
|
export CURSOR_CACHE_DIR="/tmp/cursor-cache-$$"
|
||||||
|
mkdir -p "$CURSOR_CACHE_DIR"
|
||||||
|
|
||||||
|
# Additional fixes for AppImage native modules
|
||||||
|
export APPIMAGE_EXTRACT_AND_RUN="1"
|
||||||
|
|
||||||
|
# Run the AppImage with appimage-run and additional flags
|
||||||
|
exec ${pkgs.appimage-run}/bin/appimage-run \
|
||||||
|
--no-sandbox \
|
||||||
|
--appimage-extract-and-run \
|
||||||
|
${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 \
|
||||||
|
--disable-gpu-sandbox \
|
||||||
|
--no-sandbox \
|
||||||
|
--disable-dev-shm-usage \
|
||||||
|
"$@"
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
home.username = "user";
|
||||||
|
home.homeDirectory = "/home/user";
|
||||||
|
home.stateVersion = "23.11";
|
||||||
|
|
||||||
|
# Let Home Manager install and manage itself
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
# Add Cursor to home packages
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
cursorAppImage
|
||||||
|
# Additional development tools
|
||||||
|
nodejs_20
|
||||||
|
python3
|
||||||
|
rustc
|
||||||
|
cargo
|
||||||
|
# Terminal improvements
|
||||||
|
starship
|
||||||
|
zsh
|
||||||
|
# Git tools
|
||||||
|
git-crypt
|
||||||
|
git-lfs
|
||||||
|
# Additional utilities
|
||||||
|
ripgrep
|
||||||
|
fd
|
||||||
|
bat
|
||||||
|
eza
|
||||||
|
fzf
|
||||||
|
tmux
|
||||||
|
];
|
||||||
|
|
||||||
|
# Shell configuration
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
autosuggestion.enable = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
syntaxHighlighting.enable = true;
|
||||||
|
shellAliases = {
|
||||||
|
ll = "eza -la";
|
||||||
|
la = "eza -a";
|
||||||
|
cat = "bat";
|
||||||
|
find = "fd";
|
||||||
|
grep = "rg";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Starship prompt
|
||||||
|
programs.starship = {
|
||||||
|
enable = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
settings = {
|
||||||
|
add_newline = false;
|
||||||
|
prompt_order = [ "directory" "git_branch" "git_status" "nodejs" "rust" "python" "cmd_duration" "line_break" "$all" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Git configuration
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
userName = "Your Name";
|
||||||
|
userEmail = "your.email@example.com";
|
||||||
|
extraConfig = {
|
||||||
|
init.defaultBranch = "main";
|
||||||
|
pull.rebase = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# VS Code settings (for Cursor compatibility)
|
||||||
|
home.file.".config/Code/User/settings.json".text = builtins.toJSON {
|
||||||
|
"editor.fontSize" = 14;
|
||||||
|
"editor.fontFamily" = "'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace";
|
||||||
|
"editor.fontLigatures" = true;
|
||||||
|
"editor.tabSize" = 2;
|
||||||
|
"editor.insertSpaces" = true;
|
||||||
|
"editor.rulers" = [ 80 120 ];
|
||||||
|
"editor.minimap.enabled" = false;
|
||||||
|
"workbench.colorTheme" = "Default Dark+";
|
||||||
|
"workbench.iconTheme" = "material-icon-theme";
|
||||||
|
"terminal.integrated.fontSize" = 14;
|
||||||
|
"terminal.integrated.fontFamily" = "'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Cursor-specific settings
|
||||||
|
home.file.".config/Cursor/User/settings.json".text = builtins.toJSON {
|
||||||
|
"editor.fontSize" = 14;
|
||||||
|
"editor.fontFamily" = "'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace";
|
||||||
|
"editor.fontLigatures" = true;
|
||||||
|
"editor.tabSize" = 2;
|
||||||
|
"editor.insertSpaces" = true;
|
||||||
|
"editor.rulers" = [ 80 120 ];
|
||||||
|
"editor.minimap.enabled" = false;
|
||||||
|
"workbench.colorTheme" = "Default Dark+";
|
||||||
|
"workbench.iconTheme" = "material-icon-theme";
|
||||||
|
"terminal.integrated.fontSize" = 14;
|
||||||
|
"terminal.integrated.fontFamily" = "'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace";
|
||||||
|
"cursor.chat.enabled" = true;
|
||||||
|
"cursor.chat.autoComplete" = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
home.sessionVariables = {
|
||||||
|
EDITOR = "cursor";
|
||||||
|
VISUAL = "cursor";
|
||||||
|
BROWSER = "firefox";
|
||||||
|
};
|
||||||
|
|
||||||
|
# XDG directories
|
||||||
|
xdg = {
|
||||||
|
enable = true;
|
||||||
|
userDirs = {
|
||||||
|
enable = true;
|
||||||
|
createDirectories = true;
|
||||||
|
desktop = "$HOME/Desktop";
|
||||||
|
documents = "$HOME/Documents";
|
||||||
|
download = "$HOME/Downloads";
|
||||||
|
music = "$HOME/Music";
|
||||||
|
pictures = "$HOME/Pictures";
|
||||||
|
publicShare = "$HOME/Public";
|
||||||
|
templates = "$HOME/Templates";
|
||||||
|
videos = "$HOME/Videos";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Key Changes Made
|
||||||
|
|
||||||
|
1. **Added libxkbcommon and libxkbfile** to the library path to help with keyboard mapping
|
||||||
|
2. **Added ELECTRON_RUN_AS_NODE="0"** to ensure Electron runs properly
|
||||||
|
3. **Added NODE_OPTIONS="--no-warnings"** and **NODE_ENV="production"** for better Node.js compatibility
|
||||||
|
4. **Added XDG_CACHE_HOME** environment variable with a temporary directory to avoid permission issues
|
||||||
|
5. **Added APPIMAGE_EXTRACT_AND_RUN="1"** to help with AppImage native modules
|
||||||
|
6. **Added --appimage-extract-and-run** flag to the appimage-run command
|
||||||
|
7. **Added --disable-gpu-sandbox** and **--disable-dev-shm-usage** flags to help with sandbox issues
|
||||||
|
|
||||||
|
## How to Apply These Changes
|
||||||
|
|
||||||
|
1. Open your `home.nix` file
|
||||||
|
2. Replace the existing `cursorAppImage` section with the updated version above
|
||||||
|
3. Rebuild your system with:
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake .#cursor-system
|
||||||
|
```
|
||||||
|
4. Test Cursor:
|
||||||
|
```bash
|
||||||
|
cursor --version
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Troubleshooting
|
||||||
|
|
||||||
|
If you still encounter issues:
|
||||||
|
|
||||||
|
1. Clear the AppImage cache:
|
||||||
|
```bash
|
||||||
|
rm -rf ~/.cache/appimage-run/*
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Try running Cursor with additional debugging:
|
||||||
|
```bash
|
||||||
|
cursor --enable-logging --v=1
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Check if the issue persists in a fresh terminal session
|
||||||
|
|
||||||
|
These changes should resolve the native module loading issues you're experiencing with Cursor in your NixOS flake.
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
description = "NixOS configuration with Cursor 1.3.9 AppImage";
|
description = "NixOS configuration with Cursor 1.4.2 AppImage";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
{
|
{
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.users.liam = import ./home.nix;
|
home-manager.users.user = import ./home.nix;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
{
|
{
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.users.liam = import ./test-home.nix;
|
home-manager.users.user = import ./test-home.nix;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
# Expose the Cursor package directly
|
# Expose the Cursor package directly
|
||||||
packages.x86_64-linux.cursor =
|
packages.x86_64-linux.cursor =
|
||||||
let
|
let
|
||||||
cursorConfig = self.nixosConfigurations.cursor-system.config.home-manager.users.liam.home.packages;
|
cursorConfig = self.nixosConfigurations.cursor-system.config.home-manager.users.user.home.packages;
|
||||||
cursorPackage = builtins.elemAt cursorConfig 12; # Cursor is at index 12
|
cursorPackage = builtins.elemAt cursorConfig 12; # Cursor is at index 12
|
||||||
in
|
in
|
||||||
cursorPackage;
|
cursorPackage;
|
||||||
|
|||||||
@@ -1,67 +1,67 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Cursor 1.3.9 AppImage wrapper with enhanced compatibility and update handling
|
# A robust Nix-native wrapper for the Cursor AppImage using appimageTools
|
||||||
cursorAppImage = pkgs.writeShellScriptBin "cursor" ''
|
cursor =
|
||||||
# Set up environment for better AppImage compatibility
|
let
|
||||||
export APPDIR=""
|
# First, unpack the AppImage and wrap it with the correct libraries
|
||||||
export ARGV0=""
|
unwrapped = pkgs.appimageTools.wrapType2 {
|
||||||
export OWD=""
|
pname = "cursor";
|
||||||
|
version = "1.4.2";
|
||||||
|
src = pkgs.fetchurl {
|
||||||
|
url = "https://downloads.cursor.com/production/07aa3b4519da4feab4761c58da3eeedd253a1671/linux/x64/Cursor-1.4.2-x86_64.AppImage";
|
||||||
|
sha256 = "0gb89li1aklzgc9h8y5rlrnk0n6sb4ikahaml4r9kr6ixadc4b1a";
|
||||||
|
};
|
||||||
|
|
||||||
# Disable Cursor's auto-update mechanism to prevent crashes
|
# All the libraries needed by Cursor, which will be added to the RPATH
|
||||||
export CURSOR_DISABLE_UPDATE="1"
|
extraPkgs = p: with p; [
|
||||||
export CURSOR_SKIP_UPDATE_CHECK="1"
|
glib
|
||||||
|
gtk3
|
||||||
|
cairo
|
||||||
|
pango
|
||||||
|
atk
|
||||||
|
gdk-pixbuf
|
||||||
|
xorg.libX11
|
||||||
|
xorg.libXcomposite
|
||||||
|
xorg.libXcursor
|
||||||
|
xorg.libXext
|
||||||
|
xorg.libXfixes
|
||||||
|
xorg.libXi
|
||||||
|
xorg.libXrandr
|
||||||
|
xorg.libXrender
|
||||||
|
xorg.libXtst
|
||||||
|
nss
|
||||||
|
nspr
|
||||||
|
dbus
|
||||||
|
at-spi2-atk
|
||||||
|
at-spi2-core
|
||||||
|
mesa
|
||||||
|
alsa-lib
|
||||||
|
fuse
|
||||||
|
libxkbcommon
|
||||||
|
xorg.libxkbfile
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
# Then, create a final wrapper script to set the necessary environment variables
|
||||||
|
pkgs.writeShellScriptBin "cursor" ''
|
||||||
|
#!${pkgs.bash}/bin/bash
|
||||||
|
# Set environment variables for compatibility
|
||||||
|
export CURSOR_DISABLE_UPDATE="1"
|
||||||
|
export CURSOR_SKIP_UPDATE_CHECK="1"
|
||||||
|
|
||||||
# Ensure proper library paths
|
# Create temporary directories to avoid permission issues
|
||||||
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [
|
export XDG_CACHE_HOME="$(mktemp -d -t cursor-xdg-cache-XXXXXX)"
|
||||||
pkgs.glib
|
export CURSOR_CACHE_DIR="$(mktemp -d -t cursor-cache-XXXXXX)"
|
||||||
pkgs.gtk3
|
|
||||||
pkgs.cairo
|
|
||||||
pkgs.pango
|
|
||||||
pkgs.atk
|
|
||||||
pkgs.gdk-pixbuf
|
|
||||||
pkgs.xorg.libX11
|
|
||||||
pkgs.xorg.libXcomposite
|
|
||||||
pkgs.xorg.libXcursor
|
|
||||||
pkgs.xorg.libXext
|
|
||||||
pkgs.xorg.libXfixes
|
|
||||||
pkgs.xorg.libXi
|
|
||||||
pkgs.xorg.libXrandr
|
|
||||||
pkgs.xorg.libXrender
|
|
||||||
pkgs.xorg.libXtst
|
|
||||||
pkgs.nss
|
|
||||||
pkgs.nspr
|
|
||||||
pkgs.dbus
|
|
||||||
pkgs.at-spi2-atk
|
|
||||||
pkgs.at-spi2-core
|
|
||||||
pkgs.mesa
|
|
||||||
pkgs.alsa-lib
|
|
||||||
pkgs.fuse
|
|
||||||
]}:$LD_LIBRARY_PATH"
|
|
||||||
|
|
||||||
# Set additional environment variables to handle keymapping issues
|
# Execute the unwrapped Cursor application, passing all arguments
|
||||||
export ELECTRON_DISABLE_SECURITY_WARNINGS="1"
|
exec "${unwrapped}/bin/cursor" "$@"
|
||||||
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
|
in
|
||||||
{
|
{
|
||||||
home.username = "liam";
|
home.username = "user";
|
||||||
home.homeDirectory = "/home/liam";
|
home.homeDirectory = "/home/user";
|
||||||
home.stateVersion = "23.11";
|
home.stateVersion = "23.11";
|
||||||
|
|
||||||
# Let Home Manager install and manage itself
|
# Let Home Manager install and manage itself
|
||||||
@@ -69,7 +69,7 @@ in
|
|||||||
|
|
||||||
# Add Cursor to home packages
|
# Add Cursor to home packages
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
cursorAppImage
|
cursor
|
||||||
# Additional development tools
|
# Additional development tools
|
||||||
nodejs_20
|
nodejs_20
|
||||||
python3
|
python3
|
||||||
@@ -118,8 +118,8 @@ in
|
|||||||
# Git configuration
|
# Git configuration
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userName = "Liam";
|
userName = "Your Name";
|
||||||
userEmail = "liam@example.com";
|
userEmail = "your.email@example.com";
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
init.defaultBranch = "main";
|
init.defaultBranch = "main";
|
||||||
pull.rebase = true;
|
pull.rebase = true;
|
||||||
|
|||||||
@@ -34,9 +34,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# User configuration
|
# User configuration
|
||||||
users.users.liam = {
|
users.users.user = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = "Liam";
|
description = "User";
|
||||||
extraGroups = [ "networkmanager" "wheel" "video" "audio" ];
|
extraGroups = [ "networkmanager" "wheel" "video" "audio" ];
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
# Essential tools
|
# Essential tools
|
||||||
|
|||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
home.username = "liam";
|
home.username = "user";
|
||||||
home.homeDirectory = "/home/liam";
|
home.homeDirectory = "/home/user";
|
||||||
home.stateVersion = "23.11";
|
home.stateVersion = "23.11";
|
||||||
|
|
||||||
# Let Home Manager install and manage itself
|
# Let Home Manager install and manage itself
|
||||||
@@ -58,8 +58,8 @@
|
|||||||
# Git configuration
|
# Git configuration
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userName = "Liam";
|
userName = "Your Name";
|
||||||
userEmail = "liam@example.com";
|
userEmail = "your.email@example.com";
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
init.defaultBranch = "main";
|
init.defaultBranch = "main";
|
||||||
pull.rebase = true;
|
pull.rebase = true;
|
||||||
|
|||||||
+162
@@ -0,0 +1,162 @@
|
|||||||
|
# Testing Plan for Cursor AppImage Fix
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This document outlines the steps to test the updated Cursor AppImage wrapper configuration to ensure the native module loading issues are resolved.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
1. The updated `home.nix` file with the new Cursor wrapper configuration
|
||||||
|
2. A working NixOS system with flakes enabled
|
||||||
|
3. Sudo access to rebuild the system
|
||||||
|
|
||||||
|
## Testing Steps
|
||||||
|
|
||||||
|
### 1. Apply the Configuration Changes
|
||||||
|
|
||||||
|
1. Open your `home.nix` file
|
||||||
|
2. Replace the existing `cursorAppImage` section with the updated version from `cursor-fix-solution.md`
|
||||||
|
3. Save the file
|
||||||
|
|
||||||
|
### 2. Rebuild the System
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Navigate to your flake directory
|
||||||
|
cd /path/to/cursor-flake
|
||||||
|
|
||||||
|
# Rebuild the system with the updated configuration
|
||||||
|
sudo nixos-rebuild switch --flake .#cursor-system
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected output:
|
||||||
|
- The build should complete without errors
|
||||||
|
- You should see the new Cursor package being built
|
||||||
|
|
||||||
|
### 3. Test Basic Functionality
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Test that Cursor can be invoked
|
||||||
|
cursor --version
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected output:
|
||||||
|
- Should display the Cursor version (1.3.9)
|
||||||
|
- No error messages about missing modules
|
||||||
|
|
||||||
|
### 4. Test GUI Launch
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Launch Cursor GUI
|
||||||
|
cursor
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected behavior:
|
||||||
|
- Cursor should launch without the keymapping errors
|
||||||
|
- The application should be responsive
|
||||||
|
- No console errors about native modules
|
||||||
|
|
||||||
|
### 5. Test Keyboard Functionality
|
||||||
|
|
||||||
|
Within the Cursor application:
|
||||||
|
1. Try typing in the editor
|
||||||
|
2. Test different keyboard layouts if applicable
|
||||||
|
3. Use keyboard shortcuts (Ctrl+C, Ctrl+V, etc.)
|
||||||
|
|
||||||
|
Expected behavior:
|
||||||
|
- Keyboard input should work normally
|
||||||
|
- No lag or errors when typing
|
||||||
|
- Keyboard shortcuts should function correctly
|
||||||
|
|
||||||
|
### 6. Test Project Operations
|
||||||
|
|
||||||
|
1. Open an existing project or create a new one
|
||||||
|
2. Try basic file operations (create, edit, save)
|
||||||
|
3. Test the AI features if available
|
||||||
|
|
||||||
|
Expected behavior:
|
||||||
|
- All operations should work without errors
|
||||||
|
- No crashes or unexpected behavior
|
||||||
|
|
||||||
|
### 7. Verify Environment Variables
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check that environment variables are set correctly
|
||||||
|
printenv | grep -E "(CURSOR|ELECTRON|NODE)"
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected output:
|
||||||
|
- Should show the environment variables we added
|
||||||
|
- Values should match what we specified in the configuration
|
||||||
|
|
||||||
|
### 8. Clean Cache Test
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clear AppImage cache to test fresh start
|
||||||
|
rm -rf ~/.cache/appimage-run/*
|
||||||
|
|
||||||
|
# Restart Cursor
|
||||||
|
cursor --version
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected behavior:
|
||||||
|
- Should work correctly even with cleared cache
|
||||||
|
- No errors about missing modules
|
||||||
|
|
||||||
|
## Success Criteria
|
||||||
|
|
||||||
|
The fix is considered successful if:
|
||||||
|
|
||||||
|
1. [ ] `cursor --version` runs without errors
|
||||||
|
2. [ ] Cursor GUI launches without keymapping errors
|
||||||
|
3. [ ] Keyboard input works normally in the editor
|
||||||
|
4. [ ] No native module loading errors in the console
|
||||||
|
5. [ ] All basic functionality works as expected
|
||||||
|
6. [ ] Application remains stable during extended use
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
If issues persist after applying the fix:
|
||||||
|
|
||||||
|
1. Check the system logs:
|
||||||
|
```bash
|
||||||
|
journalctl -xe
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Try running with additional debugging:
|
||||||
|
```bash
|
||||||
|
cursor --enable-logging --v=1
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Verify the AppImage is being extracted correctly:
|
||||||
|
```bash
|
||||||
|
ls -la ~/.cache/appimage-run/
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Check library dependencies:
|
||||||
|
```bash
|
||||||
|
ldd ~/.cache/appimage-run/*/usr/lib/libkeymapping.so
|
||||||
|
```
|
||||||
|
|
||||||
|
## Rollback Plan
|
||||||
|
|
||||||
|
If the updated configuration causes issues:
|
||||||
|
|
||||||
|
1. Restore the previous `home.nix` file
|
||||||
|
2. Rebuild the system:
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake .#cursor-system
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Clear the AppImage cache:
|
||||||
|
```bash
|
||||||
|
rm -rf ~/.cache/appimage-run/*
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Validation
|
||||||
|
|
||||||
|
Once the basic tests pass, perform these additional checks:
|
||||||
|
|
||||||
|
1. [ ] Test in a fresh terminal session
|
||||||
|
2. [ ] Test after system reboot
|
||||||
|
3. [ ] Test with different projects and file types
|
||||||
|
4. [ ] Verify no performance degradation
|
||||||
Reference in New Issue
Block a user