Update Cursor to version 1.5.1

This commit is contained in:
thinktankmachine
2025-08-21 15:36:11 +10:00
parent 2c6ca71d64
commit e153c80c21
3 changed files with 120 additions and 35 deletions
+52 -5
View File
@@ -1,5 +1,5 @@
{
description = "NixOS configuration with Cursor 1.4.3 AppImage";
description = "NixOS configuration with Cursor AppImage";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -37,12 +37,59 @@
};
};
# Expose the Cursor package directly
# Expose the Cursor package directly (build it explicitly instead of relying on list indices)
packages.x86_64-linux.cursor =
let
cursorConfig = self.nixosConfigurations.cursor-system.config.home-manager.users.user.home.packages;
cursorPackage = builtins.elemAt cursorConfig 12; # Cursor is at index 12
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
cursorVersion = "1.5.1";
unwrapped = pkgs.appimageTools.wrapType2 {
pname = "cursor";
version = cursorVersion;
src = pkgs.fetchurl {
url = "https://downloads.cursor.com/production/99e3b1b4d8796e167e72823eadc66ac2d51fd40c/linux/x64/Cursor-1.5.1-x86_64.AppImage";
sha256 = "0lj34g0dq561qc6h8ab8bmkp59dz0rvxbrag105pzcy7jdaxa0nn";
};
extraPkgs = p: with p; [
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
cursorPackage;
pkgs.writeShellScriptBin "cursor" ''
#!${pkgs.bash}/bin/bash
if [[ "$1" == "--version" || "$1" == "-v" ]]; then
echo "${cursorVersion}"
exit 0
fi
export CURSOR_DISABLE_UPDATE="1"
export CURSOR_SKIP_UPDATE_CHECK="1"
export XDG_CACHE_HOME="$(mktemp -d -t cursor-xdg-cache-XXXXXX)"
export CURSOR_CACHE_DIR="$(mktemp -d -t cursor-cache-XXXXXX)"
exec "${unwrapped}/bin/cursor" "$@"
'';
};
}
+3 -3
View File
@@ -7,10 +7,10 @@ let
# First, unpack the AppImage and wrap it with the correct libraries
unwrapped = pkgs.appimageTools.wrapType2 {
pname = "cursor";
version = "1.4.3";
version = "1.4.5";
src = pkgs.fetchurl {
url = "https://downloads.cursor.com/production/e50823e9ded15fddfd743c7122b4724130c25df8/linux/x64/Cursor-1.4.3-x86_64.AppImage";
sha256 = "042x8363gn6yam0hnc8aibaj7m86fyyaldfiswhzv25bgs5cwdvg";
url = "https://downloads.cursor.com/production/af58d92614edb1f72bdd756615d131bf8dfa5299/linux/x64/Cursor-1.4.5-x86_64.AppImage";
sha256 = "0gh3b5gvzbvs9lnsbgdhgy0352pkzznrrdb13l444qmyf2szaz6q";
};
# All the libraries needed by Cursor, which will be added to the RPATH
+43 -5
View File
@@ -59,11 +59,39 @@ fi
print_info "Current version: $CURRENT_VERSION"
echo ""
# Ask user if they want to update to a new version
read -p "Do you want to update to a new version? (y/N): " -n 1 -r
echo
# If a URL argument is provided, use it and skip prompts; otherwise, fallback to interactive flow
if [[ $# -ge 1 ]]; then
NEW_URL="$1"
print_info "Using provided URL: $NEW_URL"
if [[ $REPLY =~ ^[Yy]$ ]]; then
# Extract new version from provided URL
NEW_VERSION=$(echo "$NEW_URL" | grep -o 'Cursor-[0-9]\+\.[0-9]\+\.[0-9]\+' | head -1 | sed 's/Cursor-//')
if [[ -z "$NEW_VERSION" ]]; then
print_warning "Could not extract version from provided URL"
NEW_VERSION="unknown"
fi
print_info "New version: $NEW_VERSION"
# Update the URL in home.nix
sed -i "s|$CURRENT_URL|$NEW_URL|g" home.nix
print_success "Updated URL in home.nix"
# Update the version field in home.nix if present and we have a parsed version
if [[ "$NEW_VERSION" != "unknown" ]]; then
CURRENT_VERSION_IN_FILE=$(grep -o 'version = "[^"]*"' home.nix | head -1 | sed 's/version = "//;s/"//')
if [[ -n "$CURRENT_VERSION_IN_FILE" ]]; then
sed -i "s|version = \"$CURRENT_VERSION_IN_FILE\";|version = \"$NEW_VERSION\";|" home.nix
print_success "Updated version in home.nix"
fi
fi
URL_TO_HASH="$NEW_URL"
else
# Ask user if they want to update to a new version
read -p "Do you want to update to a new version? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo ""
print_info "To update to a new version:"
echo "1. Go to https://cursor.sh/"
@@ -93,9 +121,19 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
sed -i "s|$CURRENT_URL|$NEW_URL|g" home.nix
print_success "Updated URL in home.nix"
# Update the version field in home.nix if present and we have a parsed version
if [[ "$NEW_VERSION" != "unknown" ]]; then
CURRENT_VERSION_IN_FILE=$(grep -o 'version = "[^"]*"' home.nix | head -1 | sed 's/version = "//;s/"//')
if [[ -n "$CURRENT_VERSION_IN_FILE" ]]; then
sed -i "s|version = \"$CURRENT_VERSION_IN_FILE\";|version = \"$NEW_VERSION\";|" home.nix
print_success "Updated version in home.nix"
fi
fi
URL_TO_HASH="$NEW_URL"
else
else
URL_TO_HASH="$CURRENT_URL"
fi
fi
echo ""