Skip to content

code-cursor: use generic vscode package builder#413785

Merged
JohnRTitor merged 2 commits intoNixOS:masterfrom
Zaczero:code-cursor-generic-package
Jun 13, 2025
Merged

code-cursor: use generic vscode package builder#413785
JohnRTitor merged 2 commits intoNixOS:masterfrom
Zaczero:code-cursor-generic-package

Conversation

@Zaczero
Copy link
Member

@Zaczero Zaczero commented Jun 4, 2025

Updated code-cursor package to use the generic vscode package builder, which it is compatible with (apart from the extra step of unpacking the AppImage archive). This fixes hardware acceleration for me and substantially improves Cursor performance. A few more bonuses: it adds a code-cursor-fhs variant, and cursor is now able to launch in the /etc/nixos directory (whereas previously it couldn't).

image

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: vscode A free and versatile code editor that supports almost every major programming language. label Jun 4, 2025
@Zaczero Zaczero force-pushed the code-cursor-generic-package branch 2 times, most recently from afd2998 to bc203db Compare June 4, 2025 04:09
@github-actions github-actions bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Jun 4, 2025
@nix-owners nix-owners bot requested review from Prince213 and aspauldingcode June 4, 2025 04:15
@Zaczero Zaczero force-pushed the code-cursor-generic-package branch from bc203db to 8dae30d Compare June 4, 2025 04:18
@Zaczero
Copy link
Member Author

Zaczero commented Jun 4, 2025

Attribute pkgs.code-cursor was previously defined in pkgs/by-name/co/code-cursor/package.nix, but is now manually defined as callPackage ./pkgs/applications/editors/vscode/cursor.nix { /* ... */ } in pkgs/top-level/all-packages.nix.
Please move the package back and remove the manual callPackage.

This PR introduces additional instances of discouraged patterns as listed above. Merging is discouraged but would not break the base branch.

I believe this CI check does not apply to this situation.

@aspauldingcode
Copy link
Contributor

wow! tysm.

@aspauldingcode
Copy link
Contributor

at a glance here (limited time for me atm in finals) it looks like you additionally added vscode configuration for code-cursor?
so now programs.vscode.settings could point to code-cursor, if the package is set to pkgs.code-cursor?

@0xhckr 0xhckr mentioned this pull request Jun 5, 2025
13 tasks
@Zaczero
Copy link
Member Author

Zaczero commented Jun 5, 2025

at a glance here (limited time for me atm in finals) it looks like you additionally added vscode configuration for code-cursor? so now programs.vscode.settings could point to code-cursor, if the package is set to pkgs.code-cursor?

I don't know. I couldn't find the programs.vscode.settings you're talking about. If you mean the patchVSCodePath flag, it's because Cursor, unlike VSCode, has no wrapper script, so there's nothing to patch, and without it, the build fails. Maybe it could work if we added a new wrapper script, but I really don't understand what it's for and how to test it, so I didn't touch it - the previous Cursor package didn't have it.

@Prince213
Copy link
Member

I think @aspauldingcode meant the home-manager option programs.vscode.enable, which currently accepts derivations such as vscode and vscodium. While I haven't tested that myself, it seems that it should be compatible.

Copy link
Member

@Prince213 Prince213 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Briefly tested on x86_64-linux.

@Prince213
Copy link
Member

@Zaczero Please update the PR title to include the version update.

@Zaczero Zaczero changed the title code-cursor: use generic vscode package builder code-cursor: use generic vscode package builder, 0.50.5 -> 1.0.0 Jun 5, 2025
@Zaczero
Copy link
Member Author

Zaczero commented Jun 5, 2025

@Zaczero Please update the PR title to include the version update.

I hope it's good now (I'm new to nixpkgs).

@quinn-dougherty
Copy link
Contributor

I did

NIXPKGS_ALLOW_UNFREE=1 nix run github:Zaczero/nixpkgs/code-cursor-generic-package#code-cursor --impure

it built, launched, I tooled around in it a bit, then closed.

x86_64-linux. Briefly tested.

@aspauldingcode
Copy link
Contributor

I did


NIXPKGS_ALLOW_UNFREE=1 nix run github:Zaczero/nixpkgs/code-cursor-generic-package#code-cursor --impure

it built, launched, I tooled around in it a bit, then closed.

x86_64-linux. Briefly tested.

Manually closed it? Or do you mean it crashed?

@aspauldingcode
Copy link
Contributor

I think @aspauldingcode meant the home-manager option programs.vscode.enable, which currently accepts derivations such as vscode and vscodium. While I haven't tested that myself, it seems that it should be compatible.

That's what I meant, yea srry

@taha-yassine
Copy link
Contributor

I think @aspauldingcode meant the home-manager option programs.vscode.enable, which currently accepts derivations such as vscode and vscodium. While I haven't tested that myself, it seems that it should be compatible.

It currently also accepts Cursor
https://github.com/nix-community/home-manager/blob/13a45ede6c17b5e923dfc18a40a3f646436f4809/modules/programs/vscode.nix#L32

Copy link
Member

@Prince213 Prince213 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#414117 has been merged, please abandon the version bump commit.

@daviaaze
Copy link

daviaaze commented Jun 6, 2025

Performance is quite better for me, and Worked without modifications on my config

@Zaczero Zaczero force-pushed the code-cursor-generic-package branch from 5ef2935 to 2657b69 Compare June 6, 2025 04:57
@Zaczero
Copy link
Member Author

Zaczero commented Jun 6, 2025

#414117 has been merged, please abandon the version bump commit.

Done, I have taken this opportunity to keep the code-cursor package in its own directory as Windsurf does. This will now make all CI checks hopefully pass too.

@Zaczero Zaczero changed the title code-cursor: use generic vscode package builder, 0.50.5 -> 1.0.0 code-cursor: use generic vscode package builder Jun 6, 2025
@Zaczero Zaczero force-pushed the code-cursor-generic-package branch from 2657b69 to 9ce43ff Compare June 6, 2025 05:02
@0xhckr
Copy link
Contributor

0xhckr commented Jun 6, 2025

with this change would we be able to do something along the lines of

programs.vscode = {
  enable = true;
  package = pkgs.code-cursor;
  extensions = with pkgs.vscode-extensions; [
    ...
  ];
};

@Zaczero Zaczero force-pushed the code-cursor-generic-package branch from 7bc0453 to 9749e6b Compare June 12, 2025 06:22
@Zaczero
Copy link
Member Author

Zaczero commented Jun 12, 2025

@sarahec @qweered

I have set --update=false by default. I am going to assume this disables the update checks, but there is no documentation around it. --no-update was also used previously, but I am going to assume that it didn't work since --update=false was added later on in dc76202.

https://github.com/NixOS/nixpkgs/compare/8f156e3a5c4df23218c2ebffd9e4ba8735a4e0e7..9749e6bf7664cfbdefc877578ef0c0e455c0da86


Just for completeness in testing, can you say which desktop and x11 or Wayland?

My testing was done on Plasma X11. The VSCode generic builder seems to already take care of the Wayland support:

--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"

As per GTK and Qt testing, I believe this is mostly handled by the application itself and not the packaging. Given that Cursor is based on VSCode, I think it will work just fine, especially since the generic builder is battle-tested across VSCode and its forks.

@JohnRTitor
Copy link
Member

I can test on Wayland if necessary.

@sarahec let me know if darwin part is fixed and I can take a final look then and merge.

@sarahec
Copy link
Contributor

sarahec commented Jun 12, 2025

@JohnRTitor LGTM on Darwin-aarch64. Built, ran from the command line.

Copy link
Contributor

@aspauldingcode aspauldingcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty

@wegank wegank added 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. 12.approvals: 3+ This PR was reviewed and approved by three or more persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Jun 13, 2025
@JohnRTitor JohnRTitor dismissed Prince213’s stale review June 13, 2025 12:16

changes addressed

@JohnRTitor
Copy link
Member

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 413785
Commit: 9749e6bf7664cfbdefc877578ef0c0e455c0da86


x86_64-linux

✅ 2 packages built:
  • code-cursor
  • code-cursor-fhs

@JohnRTitor
Copy link
Member

I can test on Wayland if necessary.

Wayland works fine.

Co-authored-by: Masum Reza <50095635+JohnRTitor@users.noreply.github.com>
@github-actions github-actions bot removed the 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. label Jun 13, 2025
@JohnRTitor
Copy link
Member

JohnRTitor commented Jun 13, 2025

Humm, looks like eval reviewers is being cancelled because all reviewers have already left a review, but this is showing up as "failed".

https://github.com/NixOS/nixpkgs/actions/runs/15634880254/job/44047693821?pr=413785

CC @wolfgangwalther I assume this is intended?

image
image

@JohnRTitor JohnRTitor merged commit 0f4dd70 into NixOS:master Jun 13, 2025
11 of 16 checks passed
@Zaczero
Copy link
Member Author

Zaczero commented Jun 13, 2025

🎉

@wolfgangwalther
Copy link
Contributor

CC @wolfgangwalther I assume this is intended?

Uhm, no, not intended. Seems like the label workflow cancelled the reviewer request workflow. Thanks for the ping, will fix.

@0xhckr
Copy link
Contributor

0xhckr commented Jun 14, 2025

So with these changes - we still install it as per usual via pkgs.code-cursor and nothing much else changes except we get better performance and the ability to open /etc/nixos using cursor + fhs cursor, right?

@Zaczero
Copy link
Member Author

Zaczero commented Jun 14, 2025

@hackr-sh Ye

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: vscode A free and versatile code editor that supports almost every major programming language. 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 3+ This PR was reviewed and approved by three or more persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.