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
47.48k stars 2.77k forks source link

Add support for NixOS as a Dev server in remote development. #15411

Open bruno-robert opened 1 month ago

bruno-robert commented 1 month ago

Check for existing issues

Describe the feature

Headless zed installation fails when connecting to remote host running NixOS.

The following error is generated:

Could not start dynamically linked executable: /home/<username>/.local/bin/zed
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

This happens because NixOS does not support running dynamically linked executables. Ideally, the zed headless server should be packaged in Nixpkgs and installed using nix-env -iA nixos.<zed-server> or via the global configuration.

More information here.

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

No response

jansol commented 1 month ago

Should work if you install zed-editor on the server before trying to connect to it. Same with language servers on NixOS, they work fine if you install them from nixpkgs and configure zed to use the nix binary path for them.

Moshyfawn commented 1 month ago

@bruno-robert does the suggestion above work for you?

bruno-robert commented 1 month ago
  1. Install zed-editor on NixOS machine with nix-env -iA nixos.zed-editor
  2. In local Zed, connect using the "manual" option.
  3. run zed --dev-server-token <token>

Connection is successful.

I'm wondering if there is a way for local Zed to start the dev server on the remote NixOs machine (without me having to ssh in first, and run it manually with a token)?

jansol commented 1 month ago

I think it should work without the manual token setup with the latest version, once that makes its way to your nixpkgs channel. AFAIK they recently made zed check if zed --version on the remote prints what is expected and if it does it gets used as the server automatically.