Created
June 2, 2024 18:58
-
-
Save lukalotl/fcbf3216ad13b8303ab0947af0d5abd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {pkgs, ...}: let | |
| pname = "cursor"; | |
| version = "0.32.2"; | |
| src = pkgs.fetchurl { | |
| # this will break if the version is updated. | |
| # unfortunately, i couldn't seem to find a url that | |
| # points to a specific version. | |
| # alternatively, download the appimage manually and | |
| # include it via src = ./cursor.AppImage, instead of fetchurl | |
| url = "https://download.cursor.sh/linux/appImage/x64"; | |
| hash = "sha256-q2aQWMUp6Ay5kThrH/QSAFozz8IRqzySOcsM9Cy/vKo="; | |
| }; | |
| appimageContents = pkgs.appimageTools.extract {inherit pname version src;}; | |
| in | |
| with pkgs; | |
| appimageTools.wrapType2 { | |
| inherit pname version src; | |
| extraInstallCommands = '' | |
| install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications | |
| substituteInPlace $out/share/applications/${pname}.desktop \ | |
| --replace 'Exec=AppRun' 'Exec=${pname}' | |
| cp -r ${appimageContents}/usr/share/icons $out/share | |
| # unless linked, the binary is placed in $out/bin/cursor-someVersion | |
| ln -s $out/bin/${pname}-${version} $out/bin/${pname} | |
| ''; | |
| extraBwrapArgs = [ | |
| "--bind-try /etc/nixos/ /etc/nixos/" | |
| ]; | |
| # vscode likes to kill the parent so that the | |
| # gui application isn't attached to the terminal session | |
| dieWithParent = false; | |
| extraPkgs = pkgs: [ | |
| unzip | |
| autoPatchelfHook | |
| asar | |
| # override doesn't preserve splicing https://github.com/NixOS/nixpkgs/issues/132651 | |
| (buildPackages.wrapGAppsHook.override {inherit (buildPackages) makeWrapper;}) | |
| ]; | |
| } |
by the way this is probably depricated now.
In addition, I've added support for cursor for aarch64-linux, and both darwin architectures to mainline nixpkgs, pending merge PR: NixOS/nixpkgs#374944
This pr has merged and code-cursor package now supports macOS and arch64 linux.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Future readers might find this useful. I was using the
code-cursorpackage, but I wanted to use the latest unstable version only forcode-cursor.I created a
/etc/nixos/flake.nixfile:Then I updated my
/etc/nixos/configuration.nix:Then I run this
~/update.shscript to update: