Initial commit: NixOS flake with Cursor 1.3.9

- Complete NixOS configuration with Cursor AppImage
- Development environment with Node.js, Python, Rust
- Modern shell setup with Zsh and Starship
- AppImage support and desktop integration
- Comprehensive documentation and quick start guide
This commit is contained in:
thinktankmachine
2025-08-06 10:08:03 +10:00
commit b1fb7eb124
11 changed files with 823 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Cursor Flake
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+60
View File
@@ -0,0 +1,60 @@
# Quick Start Guide
Get Cursor 1.3.9 running on NixOS in minutes!
## Prerequisites
- NixOS system with flakes enabled
- Git installed
## Quick Setup
1. **Clone and enter the repository:**
```bash
git clone <your-repo-url>
cd cursor-flake
```
2. **Customize the username** (optional):
- Edit `home.nix` and change `home.username = "liam";` to your username
- Edit `configuration.nix` and change `users.users.liam` to your username
3. **Deploy to your system:**
```bash
sudo nixos-rebuild switch --flake .#cursor-system
```
4. **Launch Cursor:**
- From applications menu: Look for "Cursor"
- From terminal: Run `cursor`
## What You Get
- ✅ **Cursor 1.3.9**: Latest AI-first code editor
- ✅ **Development Environment**: Node.js, Python, Rust, Git
- ✅ **Modern Shell**: Zsh with Starship prompt
- ✅ **CLI Tools**: ripgrep, fd, bat, eza, fzf, tmux
- ✅ **Desktop Integration**: GNOME with proper launcher
## Testing
To test before deploying:
```bash
# Build the system (takes a few minutes)
nix build .#nixosConfigurations.cursor-system.config.system.build.vm
# Run in VM (optional)
./result/bin/run-cursor-system-vm
```
## Troubleshooting
- **Cursor won't start**: Make sure you have FUSE support enabled
- **Permission issues**: Check that your user is in the correct groups
- **Build fails**: Run `nix flake check` to validate the configuration
## Next Steps
- Customize your development environment in `home.nix`
- Add your own packages to the configuration
- Check the full README.md for detailed documentation
+165
View File
@@ -0,0 +1,165 @@
# 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
```bash
git clone <your-repo-url>
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:
```bash
./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 settings
- `home.nix`: User-specific settings (change username from "liam" to your username)
- `hardware-configuration.nix`: Hardware-specific settings (run `nixos-generate-config` on your target system)
### 4. Build and Switch
```bash
# 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:
1. Log in as the configured user
2. Cursor will be available in the applications menu
3. 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:
1. **Add packages**: Edit `home.nix` and add to `home.packages`
2. **Change shell**: Modify the shell configuration in `home.nix`
3. **Update Cursor settings**: Edit the settings in `home.nix`
4. **System packages**: Add to `environment.systemPackages` in `configuration.nix`
## Troubleshooting
### AppImage Issues
If Cursor doesn't run properly:
1. Check if AppImage support is enabled:
```bash
ls /proc/sys/fs/binfmt_misc/
```
2. Reinstall AppImage support:
```bash
sudo nixos-rebuild switch --flake .#cursor-system
```
### Permission Issues
If you encounter permission issues:
1. Ensure the user is in the correct groups:
```bash
groups
```
2. Add user to additional groups if needed in `configuration.nix`
### Update Cursor
To update to a newer version of Cursor:
1. Update the version number in `home.nix`
2. Update the download URL if needed
3. Update the SHA256 hash
4. 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
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Test the configuration
5. Submit a pull request
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Support
For issues and questions:
1. Check the troubleshooting section
2. Search existing issues
3. 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
+108
View File
@@ -0,0 +1,108 @@
{ config, pkgs, lib, ... }:
{
imports = [
./hardware-configuration.nix
];
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Enable AppImage support
boot.binfmt.emulatedSystems = [ ];
# Networking
networking.networkmanager.enable = true;
networking.hostName = "cursor-system";
# Time zone
time.timeZone = "UTC";
# Internationalisation
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# X11 and Desktop Environment
services.xserver.enable = true;
services.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
# Enable sound with pipewire
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# User configuration
users.users.liam = {
isNormalUser = true;
description = "Liam";
extraGroups = [ "networkmanager" "wheel" "video" "audio" ];
# Set explicit password (password: cursor)
hashedPassword = "$6$thkdqD1PCLUj6X9i$iPEOKRohaybp7XMYpyb7Zjd.Gdcl/weC732CYMlQ4ql7YDY8CLmSIqSUeH/efSnW.Wq9ICn2T5P5RSOqTqNlF0";
packages = with pkgs; [
# Essential tools
git
wget
curl
unzip
# AppImage support
appimage-run
# Development tools
gcc
gnumake
# Terminal
alacritty
# File manager
nautilus
];
};
# Allow unfree packages (needed for some AppImages)
nixpkgs.config.allowUnfree = true;
# System packages
environment.systemPackages = with pkgs; [
# AppImage utilities
appimage-run
# Desktop utilities
gnome-tweaks
gnome-software
# System utilities
htop
neofetch
# Media support
ffmpeg
vlc
];
# Enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Garbage collection
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
system.stateVersion = "23.11";
}
Generated
+48
View File
@@ -0,0 +1,48 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1754421590,
"narHash": "sha256-TrlzGR5l/OltcTnBtihUxoKqv+JNEKWmUamDVWICtX0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "a0b1afdb5efbf59f4b6e934d090cf8d150517890",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1754214453,
"narHash": "sha256-Q/I2xJn/j1wpkGhWkQnm20nShYnG7TI99foDBpXm1SY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5b09dc45f24cf32316283e62aec81ffee3c3e376",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+40
View File
@@ -0,0 +1,40 @@
{
description = "NixOS configuration with Cursor 1.3.9 AppImage";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager }: {
nixosConfigurations = {
cursor-system = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.liam = import ./home.nix;
}
];
};
test-system = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./test-configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.liam = import ./test-home.nix;
}
];
};
};
};
}
+35
View File
@@ -0,0 +1,35 @@
# Do not modify this file! It was generated by 'nixos-generate-config'
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports = [ ];
boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/placeholder";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/placeholder";
fsType = "vfat";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+134
View File
@@ -0,0 +1,134 @@
{ config, pkgs, lib, ... }:
let
# Cursor 1.3.9 AppImage wrapper
cursorAppImage = pkgs.writeShellScriptBin "cursor" ''
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";
}} "$@"
'';
in
{
home.username = "liam";
home.homeDirectory = "/home/liam";
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 = "Liam";
userEmail = "liam@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";
};
};
}
+88
View File
@@ -0,0 +1,88 @@
{ config, pkgs, lib, ... }:
{
imports = [
./hardware-configuration.nix
];
# Bootloader
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Networking
networking.networkmanager.enable = true;
networking.hostName = "cursor-test-system";
# Time zone
time.timeZone = "UTC";
# Internationalisation
i18n.defaultLocale = "en_US.UTF-8";
# X11 and Desktop Environment
services.xserver.enable = true;
services.displayManager.gdm.enable = true;
services.desktopManager.gnome.enable = true;
# Enable sound with pipewire
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# User configuration
users.users.liam = {
isNormalUser = true;
description = "Liam";
extraGroups = [ "networkmanager" "wheel" "video" "audio" ];
packages = with pkgs; [
# Essential tools
git
wget
curl
unzip
# AppImage support
appimage-run
# Development tools
gcc
gnumake
# Terminal
alacritty
# File manager
nautilus
];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# System packages
environment.systemPackages = with pkgs; [
# AppImage utilities
appimage-run
# Desktop utilities
gnome-tweaks
gnome-software
# System utilities
htop
neofetch
# Media support
ffmpeg
vlc
];
# Enable flakes
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Garbage collection
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
system.stateVersion = "23.11";
}
+92
View File
@@ -0,0 +1,92 @@
{ config, pkgs, lib, ... }:
{
home.username = "liam";
home.homeDirectory = "/home/liam";
home.stateVersion = "23.11";
# Let Home Manager install and manage itself
programs.home-manager.enable = true;
# Add development tools to home packages
home.packages = with pkgs; [
# 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 = "Liam";
userEmail = "liam@example.com";
extraConfig = {
init.defaultBranch = "main";
pull.rebase = true;
};
};
# Environment variables
home.sessionVariables = {
EDITOR = "nano";
VISUAL = "nano";
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";
};
};
}
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Script to update the SHA256 hash for Cursor AppImage
# Run this script to get the correct hash and update home.nix
set -e
echo "Fetching SHA256 hash for Cursor 1.3.9 AppImage..."
echo ""
# Get the hash
HASH=$(nix-prefetch-url https://downloads.cursor.com/production/54c27320fab08c9f5dd5873f07fca101f7a3e076/linux/x64/Cursor-1.3.9-x86_64.AppImage)
echo "SHA256 hash: $HASH"
echo ""
echo "Please update the hash in home.nix:"
echo "Replace the placeholder hash with:"
echo "sha256 = \"$HASH\";"
echo ""
echo "You can do this manually or run:"
echo "sed -i 's/sha256 = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\";/sha256 = \"$HASH\";/' home.nix"
echo ""
# Optionally update the file automatically
read -p "Do you want to update home.nix automatically? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
sed -i "s/sha256 = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\";/sha256 = \"$HASH\";/" home.nix
echo "Updated home.nix with the correct hash!"
else
echo "Please update home.nix manually with the hash above."
fi