diff --git a/README.md b/README.md index 42e3c18..66042b3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Self-Updating Cursor Flake -A Nix flake that provides the Cursor code editor with automatic daily updates via GitHub Actions. +A Nix flake that provides the Cursor code editor with automatic daily updates via CI (GitHub Actions-compatible workflows, e.g. GitHub Actions or Gitea Actions). + +This fork includes **native `aarch64-linux` (linux-arm64) support** in addition to `x86_64-linux`. ## Features @@ -15,7 +17,7 @@ A Nix flake that provides the Cursor code editor with automatic daily updates vi ### Method 1: Direct Installation ```bash # Install Cursor directly -nix profile install github:your-username/cursor-nixos-flake +nix profile install git+https://git.chiasson.cloud/Olivier/cursor-nixos-flake # Run Cursor cursor --version @@ -24,7 +26,7 @@ cursor --version ### Method 2: Add to Your Flake Add to your `flake.nix` inputs: ```nix -inputs.cursor.url = "github:your-username/cursor-nixos-flake"; +inputs.cursor.url = "git+https://git.chiasson.cloud/Olivier/cursor-nixos-flake"; ``` Then use in your configuration: @@ -50,10 +52,10 @@ devShells.default = pkgs.mkShell { ### Method 3: Temporary Run ```bash # Run without installing -nix run github:your-username/cursor-nixos-flake +nix run git+https://git.chiasson.cloud/Olivier/cursor-nixos-flake # Build and run -nix build github:your-username/cursor-nixos-flake +nix build git+https://git.chiasson.cloud/Olivier/cursor-nixos-flake ./result/bin/cursor ``` @@ -64,9 +66,6 @@ To manually update Cursor to the latest version: ```bash ./update-cursor.sh ``` - -Note: on a fresh fork, `cursor-release.nix` may contain a placeholder aarch64 hash until you run the updater once (or trigger the GitHub Action via `workflow_dispatch`). - To update to a specific version: ```bash @@ -76,11 +75,11 @@ To update to a specific version: ## How It Works ### Automatic Updates -The GitHub Actions workflow runs daily and: +The CI workflow in `.github/workflows/update-cursor.yml` runs daily and: 1. Checks Cursor's API for the latest version 2. Only updates if a new version is available 3. Downloads the AppImage and calculates SHA256 hash -4. Updates `cursor-release.nix` with the new version and per-architecture hashes +4. Updates `cursor-release.nix` with the new version and **per-architecture hashes** (`x86_64-linux` + `aarch64-linux`) 5. Tests the build and commits changes 6. Pushes the update back to the repository @@ -93,14 +92,12 @@ The `update-cursor.sh` script provides: ## API Endpoints -- **AppImage Download**: `https://api2.cursor.sh/updates/download/golden/linux-x64/cursor/{version}` +- **x86_64 AppImage Download**: `https://api2.cursor.sh/updates/download/golden/linux-x64/cursor/{version}` +- **aarch64 AppImage Download**: `https://api2.cursor.sh/updates/download/golden/linux-arm64/cursor/{version}` ## Testing ```bash -# Test the complete setup -./test-setup.sh - # Test flake syntax nix flake check diff --git a/test-setup.sh b/test-setup.sh deleted file mode 100755 index 3b8b0fa..0000000 --- a/test-setup.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -# Test script to verify the Cursor flake setup -echo "Testing Cursor Flake Setup" -echo "=========================" - -# Check if we're in the right directory -if [[ ! -f "flake.nix" ]]; then - echo "Error: flake.nix not found. Please run this script from the flake directory." - exit 1 -fi - -# Test 1: Check flake syntax -echo "1. Testing flake syntax..." -if command -v nix >/dev/null 2>&1; then - if nix flake check --no-build; then - echo " ✓ Flake syntax is valid" - else - echo " ✗ Flake syntax error" - exit 1 - fi -else - echo " ⚠ Skipping flake check (nix not available)" -fi - -# Test 2: Check update script -echo "2. Testing update script..." -if [[ -f "update-cursor.sh" && -x "update-cursor.sh" ]]; then - echo " ✓ Update script exists and is executable" - - # Test script help - if ./update-cursor.sh --help 2>/dev/null || ./update-cursor.sh -h 2>/dev/null; then - echo " ✓ Update script help works" - else - echo " ⚠ Update script help not available (this is normal)" - fi -else - echo " ✗ Update script missing or not executable" - exit 1 -fi - -# Test 3: Check GitHub Actions workflow -echo "3. Testing GitHub Actions workflow..." -if [[ -f ".github/workflows/update-cursor.yml" ]]; then - echo " ✓ GitHub Actions workflow exists" - - # Basic YAML syntax check - if command -v yamllint >/dev/null 2>&1; then - if yamllint .github/workflows/update-cursor.yml >/dev/null 2>&1; then - echo " ✓ Workflow YAML syntax is valid" - else - echo " ⚠ Workflow YAML syntax issues (yamllint not available or found issues)" - fi - else - echo " ⚠ Skipping YAML validation (yamllint not available)" - fi -else - echo " ✗ GitHub Actions workflow missing" - exit 1 -fi - -# Test 4: Check API connectivity -echo "4. Testing API connectivity..." -if command -v curl >/dev/null 2>&1; then - if curl -s --max-time 10 -I "https://api2.cursor.sh/updates/download/golden/linux-x64/cursor/latest" >/dev/null 2>&1; then - echo " ✓ Cursor API is accessible" - else - echo " ⚠ Cursor API not accessible (this might be temporary)" - fi -else - echo " ⚠ Skipping API test (curl not available)" -fi - -# Test 5: Check current version -echo "5. Checking current version..." -if [[ -f "cursor-release.nix" ]]; then - CURRENT_VERSION=$(grep -o 'version = "[^"]*"' cursor-release.nix | head -1 | cut -d'"' -f2) -else - CURRENT_VERSION=$(grep -o 'version = "[^"]*"' flake.nix | head -1 | cut -d'"' -f2) -fi -echo " Current version: $CURRENT_VERSION" - -# Test 6: Check if SHA256 is placeholder -echo "6. Checking SHA256 hash..." -if [[ -f "cursor-release.nix" ]]; then - CURRENT_SHA256=$(grep -o 'x86_64-linux = "[^"]*"' cursor-release.nix | head -1 | cut -d'"' -f2) -else - CURRENT_SHA256=$(grep -o 'sha256 = "[^"]*"' flake.nix | head -1 | cut -d'"' -f2) -fi -if [[ "$CURRENT_SHA256" == "0000000000000000000000000000000000000000000000000000" ]]; then - echo " ⚠ SHA256 is placeholder - needs to be updated" -else - echo " ✓ SHA256 appears to be set" -fi - -echo "" -echo "Test Summary" -echo "============" -echo "Setup appears to be mostly correct!" -echo "" -echo "Next steps:" -echo "1. Run './update-cursor.sh' to get the correct SHA256 hash" -echo "2. Commit and push your changes to enable GitHub Actions" -echo "3. Check the Actions tab in GitHub to see if the workflow runs" -echo "" -echo "For manual testing:" -echo "- nix build .#cursor --dry-run" -echo "- nix run .#cursor --version"