Cursor is now available on nixos

I’ve added cursor to nixpkgs-unstable as code-cursor. You can find it in the nixpkgs search.

Caveats:

  • Linux-only. Cursor is packaged as an AppImage and requires a FHS environment which won’t work on Darwin. (You’re better off with the official release binaries from here on Darwin and Windows).
  • Updates will lag the official cursor releases. There’s an update bot (or someone can update manually), plus time for approval, merging, and going through Hydra.
  • Bugs in the app? Please report them here.
  • Need an update? Open a packaging request or submit a PR to update. We won’t bite, promise.
4 Likes

I’m not sure how to provide better reporting but would be happy to if I can find out how but the window opens and then nothing happens.

[lazylambda@nixos:~]$ sudo nix-channel --list
nixos https://nixos.org/channels/nixos-24.05
environment.systemPackages = (

  let unstable = import (pkgs.fetchFromGitHub {
        owner="NixOS";
		    repo="nixpkgs";
        rev="1bbe1fee60c10d628efbc639783197d1020c5463";# "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24bs";
       	sha256= "sha256-igwdKMfWCo6pKMldoSKhTsx5QKSM7JXjbK6tCllSzlU=";
	    }) { config = {
             allowUnfree = true;
             overlays = [
               (import (builtins.fetchTarball {
                 url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
               }))
             ];
           };
         };
in
    with pkgs [ <omitted > ] ++
    [ <omitted>
    unstable.code-cursor
    ]
)

This is awesome.

Does anyone know how to use Cursor with a flake dev environment? I expect to be able to do
nix develop
cursor .

This works with VS Code but not Cursor. Right now I can’t use Cursor for development unless I install everything globally which is really annoying. There might be a simple fix for this but I’m a Nix novice and haven’t been able to figure one out.

I’m testing this out right now.

If you could do me a favor, please run nix flake check flake.nix --impure and let me know if you see any errors such as " error: attribute ‘code-cursor’ missing".

No errors, just an empty output.

I need additional maintainers on the package. Until then, expect minimal support and updates.

Extra maintainers would also expedite getting new releases sooner, keeping it backported, etc. I get pushback from reviewers over it being an unfree package and that delays new commits.

P.S. In an ideal world, the cursor people would maintain the derivation. I’m happy to walk them through getting started.

I got it working. I needed to move everything into buildInputs instead of having some things in nativeBuildInputs. I’m still not sure why VS Code worked without this change though.

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
  };
  outputs =
    {
      self,
      nixpkgs,
    }:

    let
      pkgs = import nixpkgs {
        system = "x86_64-linux";
        config = {
          allowUnfree = true;
        };
      };
    in
    with pkgs;
    {
      devShells.x86_64-linux.default = mkShell {
        buildInputs = [
          cargo
          rustc
          SDL2
          alsa-lib.dev
          code-cursor
          pkg-config
        ];

        shellHook = ''
          export PKG_CONFIG_PATH=${pkgs.alsa-lib.dev}/lib/pkgconfig:$PKG_CONFIG_PATH
        '';
      };
    };
}

  1. You’re a rock star.
  2. nativeBuildInputs is for the build system itself. buildInputs are the things to be built.
  3. vscode has a bunch of extra work to make it operate in cases like this. Unfortunately, I don’t have that much time to productionize this package.
  4. Want to be one of the maintainers?
1 Like

FYI, I deleted the backport request. I’m already getting more support requests than I have time for (I’m just a volunteer nixpkgs maintainer).

This can go into the stable channel after we have enough maintainers to field issues.

Having run into a similar issue with logseq recently (also packaged as an AppImage), I suspect the problem is a mismatch between the packages available in 24.05 and the ones needed by cursor.

Hi! I’m an amateur Nix/NixOS user and interested potential Cursor user. I currently use VSCodium, and within that package I have the ability to declaratively specify which extensions to install. Cursor has an auto-import-from-VSCode feature, but - as I expected - that doesn’t work for VSCode installed under Nix.

I’m not expert enough to know for sure, but it seems like declarative configuration of extensions is not currently possible with Cursor. Is that a correct understanding?

I would be interested to explore contributing a fix for this if there is a viable strategy for appimages within Nix, I just don’t know how to go about it yet.

Yes, you’re correct. Extensions live in this weird liminal space where they can be downloaded, automatically patched, and executed; they still work on Cursor they way they would on a generic Linux.

Making declarative configuration work could be tricky. For vscode, python, etc. extensions/packages are compiled against their base package and it generates a new binary.

Could that be done with an AppImage? Possibly. An AppImage contains a binary executable and a read-only filesystem via squishfs. The usual nixos build unpacks the app image, mounts the r/o filesystem, copies some files into $out to match desktop expectations, patches the executable, then packs it all up again. (Note: This only applies to Linux. Cursor ships disk image files for Darwin and I haven’t looked at that repackaging process yet.)

The big question is: where do the extensions live? If they live in the filesystem portion (likely), we’d have to unpack, modify, and repack the filesystem part. We have someone exploring that idea to patch a long-standing display error on gtk-based desktops.

I’m sorry there’s no easy answer. If you choose to try it, make sure you have an account on the Discord as well as on Matrix (chat). If you file a PR, I’m the maintainer for code-cursor and I’m happy to help you through the process.

P.S. If you decide to try this, create a new derivation such as code-cursor-with-extensions and inherit the desired sources from code-cursor.