From 7cb44f20f6b3d7404bddbad5c053e6107ecc5898 Mon Sep 17 00:00:00 2001 From: Jan Solanti Date: Wed, 6 Nov 2024 20:15:31 +0200 Subject: [PATCH] zed-editor: make node-based built-in LSPs work on NixOS Since version 0.155.2 Zed has checked PATH for a node.js binary before attempting to download its own. Make use of this by prepending a nixpkgs-provided node.js into PATH via a wrapper script around the main `zed-editor` binary. --- pkgs/by-name/ze/zed-editor/package.nix | 30 ++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/ze/zed-editor/package.nix b/pkgs/by-name/ze/zed-editor/package.nix index 1c72fe416dc9..f2216c0224d7 100644 --- a/pkgs/by-name/ze/zed-editor/package.nix +++ b/pkgs/by-name/ze/zed-editor/package.nix @@ -34,6 +34,8 @@ git, apple-sdk_15, darwinMinVersionHook, + makeWrapper, + nodePackages_latest, withGLES ? false, }: @@ -138,17 +140,20 @@ rustPlatform.buildRustPackage rec { }; }; - nativeBuildInputs = [ - clang - cmake - copyDesktopItems - curl - perl - pkg-config - protobuf - rustPlatform.bindgenHook - cargo-about - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ cargo-bundle ]; + nativeBuildInputs = + [ + clang + cmake + copyDesktopItems + curl + perl + pkg-config + protobuf + rustPlatform.bindgenHook + cargo-about + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ makeWrapper ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ cargo-bundle ]; dontUseCmakeConfigure = true; @@ -215,6 +220,9 @@ rustPlatform.buildRustPackage rec { postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' patchelf --add-rpath ${gpu-lib}/lib $out/libexec/* patchelf --add-rpath ${wayland}/lib $out/libexec/* + wrapProgram $out/libexec/zed-editor --suffix PATH : ${ + lib.makeBinPath [ nodePackages_latest.nodejs ] + } ''; preCheck = ''