zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.85k stars 3.15k forks source link

Environment clear makes nix-ld (NixOS) not work #21264

Closed fzakaria closed 2 days ago

fzakaria commented 2 days ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I have been playing with Zed and I noticed:

2024-11-27T16:13:38.995418484-08:00 [ERROR] Failed to install default prettier: prettier & plugins install: fetching latest npm versions: fetching latest npm version for package prettier-plugin-java: failed to execute npm info subcommand:
stdout: ""
stderr: "cannot execute /home/fmzakari/.local/share/zed/node/node-v22.5.1-linux-x64/bin/node: You are trying to run an unpatched binary on nixos, but you have not configured NIX_LD or NIX_LD_x86_64-linux. See https://github.com/Mic92/nix-ld for more details\n"

NIX_LD is this way to mock out a FHS on NixOS machines https://github.com/nix-community/nix-ld

It basically works by allowing a custom LD_LIBRARY_PATH only for binaries built in the traditional model when run on NixOS. Kind of like a global FHS on a NixOS system.

Anyways, I have NIX_LD set in my environment but i was surprised to see this message. (NIX_LD has helped me get through a lot of similar issues on Visual Studio Code)

fmzakari@nyx ~/c/g/f/nix-home ((7e391207))> env | grep NIX_LD
NIX_LD_LIBRARY_PATH=/run/current-system/sw/share/nix-ld/lib
NIX_LD=/run/current-system/sw/share/nix-ld/lib/ld.so

Issue seems to be that the environment is cleared before the exec is called. https://github.com/zed-industries/zed/blob/main/crates/node_runtime/src/node_runtime.rs#L408

Environment

Zed: v0.162.5 (Zed) OS: Linux X11 nixos 24.05 Memory: 60.6 GiB Architecture: x86_64 GPU: AMD Radeon Graphics (RADV GFX1103_R1) || radv || Mesa 24.0.7

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log ``` ```

Zed.log.txt

fzakaria commented 2 days ago

Dang -- I swear I checked the backlog :( https://github.com/zed-industries/zed/issues/20524

I just found it.