4.1 KiB
Cursor Flake
A NixOS flake that provides a complete development environment with Cursor 1.3.9 (AI-first code editor) as an AppImage.
Features
- Cursor 1.3.9: Latest version of the AI-first code editor
- AppImage Support: Full AppImage compatibility with proper desktop integration
- Development Tools: Complete development environment with Node.js, Python, Rust, and more
- Modern Shell: Zsh with Starship prompt and useful aliases
- Desktop Environment: GNOME with essential utilities
- Git Integration: Pre-configured Git with modern defaults
Prerequisites
- NixOS system with flakes enabled
- At least 8GB RAM recommended
- 20GB free disk space
Installation
1. Clone the Repository
git clone https://github.com/thinktankmachine/cursor-nixos-flake
cd cursor-flake
2. Update the SHA256 Hash (if needed)
The current configuration uses the working Cursor 1.3.9 download URL. If you need to update to a newer version, run:
./update-cursor-hash.sh
This will automatically update the hash in home.nix with the correct value.
3. Customize Configuration
Edit the following files to match your system:
configuration.nix: System-wide settingshome.nix: User-specific settings (change username from "liam" to your username)hardware-configuration.nix: Hardware-specific settings (runnixos-generate-configon your target system)
4. Build and Switch
# Build the configuration
sudo nixos-rebuild build --flake .#cursor-system
# Switch to the new configuration
sudo nixos-rebuild switch --flake .#cursor-system
5. First Boot Setup
After the first boot:
- Log in as the configured user
- Cursor will be available in the applications menu
- You can also launch it from the terminal with
cursor
Configuration
Cursor Settings
The flake includes pre-configured Cursor settings in ~/.config/Cursor/User/settings.json:
- Modern font (JetBrains Mono with ligatures)
- Dark theme
- Optimized editor settings
- Cursor AI features enabled
Development Environment
The flake includes:
- Languages: Node.js 20, Python 3, Rust
- Tools: Git, ripgrep, fd, bat, exa, fzf, tmux
- Shell: Zsh with Starship prompt
- Terminal: Alacritty
Customization
To customize the configuration:
- Add packages: Edit
home.nixand add tohome.packages - Change shell: Modify the shell configuration in
home.nix - Update Cursor settings: Edit the settings in
home.nix - System packages: Add to
environment.systemPackagesinconfiguration.nix
Troubleshooting
AppImage Issues
If Cursor doesn't run properly:
-
Check if AppImage support is enabled:
ls /proc/sys/fs/binfmt_misc/ -
Reinstall AppImage support:
sudo nixos-rebuild switch --flake .#cursor-system
Permission Issues
If you encounter permission issues:
-
Ensure the user is in the correct groups:
groups -
Add user to additional groups if needed in
configuration.nix
Update Cursor
To update to a newer version of Cursor:
- Update the version number in
home.nix - Update the download URL if needed
- Update the SHA256 hash
- Rebuild the system
File Structure
cursor-flake/
├── flake.nix # Main flake definition
├── configuration.nix # NixOS system configuration
├── home.nix # Home Manager user configuration
├── hardware-configuration.nix # Hardware-specific settings
└── README.md # This file
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test the configuration
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For issues and questions:
- Check the troubleshooting section
- Search existing issues
- Create a new issue with detailed information
Acknowledgments
- Cursor team for the excellent AI-first editor
- NixOS community for the amazing package management system
- Home Manager for user configuration management