Zed: Difference between revisions
Ekonovalov (talk | contribs) m fix typo in the option's name |
|||
| (4 intermediate revisions by 2 users not shown) | |||
| Line 19: | Line 19: | ||
<!--T:1--> | <!--T:1--> | ||
[https://zed.dev Zed]<ref>Zed Industries, "Zed", Official Website, Accessed October 2025. https://zed.dev</ref> is a collaborative, GPU-accelerated text editor developed by Zed Industries. It combines fast local editing with real-time multiplayer features and ships with batteries-included tooling for popular programming languages. | [https://zed.dev Zed]<ref>Zed Industries, "Zed", Official Website, Accessed October 2025. https://zed.dev</ref> is a collaborative, GPU-accelerated text editor developed by Zed Industries. It combines fast local editing with real-time multiplayer features and ships with batteries-included tooling for popular programming languages. | ||
<!--T:2--> | <!--T:2--> | ||
The editor provides native builds for Linux, including Nixpkgs packages and a reproducible flake. Hardware acceleration requires a GPU with Vulkan support; systems without Vulkan can fall back to emulation via tools such as [https://github.com/nix-community/nixGL nixGL].<ref>Zed Industries, "Linux", Zed Documentation, Accessed October 2025. https://zed.dev/docs/linux</ref> | The editor provides native builds for Linux, including Nixpkgs packages and a reproducible flake. Hardware acceleration requires a GPU with Vulkan support; systems without Vulkan can fall back to emulation via tools such as [https://github.com/nix-community/nixGL nixGL].<ref>Zed Industries, "Linux", Zed Documentation, Accessed October 2025. https://zed.dev/docs/linux</ref> | ||
< | <!--T:5--> | ||
{{Nixpkg|pkgs/by-name/ze/zed-editor|zed-editor}} is available in Nixpkgs since 24.11; However, Zed provides [https://github.com/zed-industries/zed/blob/main/flake.nix an official nix flake] which might be useful if you need features that have not yet reached unstable Nixpkgs. | |||
== Installation == <!--T:3--> | == Installation == <!--T:3--> | ||
==== | <!--T:6--> | ||
The package installs both desktop launchers and a CLI entry point aliased to <code>zeditor</code>, mirroring the upstream binary name | |||
=== Imperative === <!--T:4--> | |||
==== Zed's Flake ==== <!--T:45--> | |||
</translate> | </translate> | ||
<syntaxhighlight lang="console"> | |||
nix run github:zed-industries/zed | |||
</syntaxhighlight> | |||
==== Nixpkgs ==== | |||
<syntaxhighlight lang="console"> | |||
nix run nixpkgs#zed-editor | |||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T: | === Declarative === <!--T:7--> | ||
</translate> | |||
==== NixOS ==== | |||
<syntaxhighlight lang="nix"> | |||
environment.systemPackages = [ | environment.systemPackages = [ | ||
pkgs.zed-editor | pkgs.zed-editor | ||
]; | ]; | ||
</syntaxhighlight> | |||
{{Evaluate}} | |||
==== Home Manager ==== | |||
<syntaxhighlight lang="nix"> | |||
home.packages = [ | home.packages = [ | ||
pkgs.zed-editor | pkgs.zed-editor | ||
]; | ]; | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="console"> | |||
home-manager switch | |||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T: | ==== Zed's Flake ==== <!--T:9--> | ||
</translate> | |||
== | <syntaxhighlight lang="nix"> | ||
{ | |||
inputs.zed.url = "github:zed-industries/zed"; | |||
outputs = | |||
{ | |||
self, | |||
{{ | nixpkgs, | ||
zed, | |||
... | |||
}@inputs: | |||
let | |||
system = "x86_64-linux"; | |||
pkgs = import nixpkgs { inherit system; }; | |||
in | |||
{ | |||
packages.${system}.zed-latest = zed.packages.${system}.default; | |||
}; | |||
} | |||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:11--> | <!--T:11--> | ||
Build the flake package with <code>nix build .#zed-latest</code> or expose it in your configuration with the appropriate overlay. | Build the flake package with <code>nix build .#zed-latest</code> or expose it in your configuration with the appropriate overlay. | ||
<!--T:12--> | <!--T:12--> | ||
Providing Vulkan through <code>nixGL</code> can be more consistent than relying on host distribution packages, especially on non-NixOS systems where Wayland and X11 stacks differ in their Vulkan capabilities. | {{Warning|Zed requires hardware-accelerated Vulkan. On systems without supported drivers, use <code>nixGL</code> or home-manager's <code>nixGL.vulkan.enable {{=}} true;</code> to provide the necessary libraries. | ||
Providing Vulkan through <code>nixGL</code> can be more consistent than relying on host distribution packages, especially on non-NixOS systems where Wayland and X11 stacks differ in their Vulkan capabilities.}} | |||
== Configuration == <!--T:13--> | == Configuration == <!--T:13--> | ||
| Line 83: | Line 111: | ||
==== Basic ==== <!--T:15--> | ==== Basic ==== <!--T:15--> | ||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | |||
programs.zed-editor = { | |||
enable = true; | enable = true; | ||
extensions = [ "nix" "toml" "rust" ]; | extensions = [ "nix" "toml" "rust" ]; | ||
| Line 95: | Line 125: | ||
vim_mode = true; | vim_mode = true; | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:16--> | <!--T:16--> | ||
| Line 102: | Line 134: | ||
==== Advanced ==== <!--T:17--> | ==== Advanced ==== <!--T:17--> | ||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | |||
programs.zed-editor = { | programs.zed-editor = { | ||
enable = true; | enable = true; | ||
| Line 234: | Line 267: | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:18--> | <!--T:18--> | ||
| Line 240: | Line 274: | ||
<!--T:19--> | <!--T:19--> | ||
The <code>userSettings</code> and <code> | The <code>userSettings</code> and <code>userKeymaps</code> options translate directly into JSON. The <code>extraPackages</code> option includes additional Nixpkgs in the FHS environment, useful for LSP servers (e.g., <code>pkgs.nixd</code>) or optional tools (e.g., <code>pkgs.shellcheck</code> for the Basher LSP). | ||
<!--T:20--> | <!--T:20--> | ||
| Line 270: | Line 304: | ||
Use <code>pkgs.zed-editor.fhsWithPackages</code> to extend the FHS environment with additional system libraries when a language server requires them. | Use <code>pkgs.zed-editor.fhsWithPackages</code> to extend the FHS environment with additional system libraries when a language server requires them. | ||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | |||
pkgs.zed-editor.fhsWithPackages( | |||
pkgs: with pkgs; [ | |||
openssl | |||
zlib | |||
] | |||
) | |||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:26--> | <!--T:26--> | ||
| Line 289: | Line 332: | ||
If automatic detection doesn't work, specify the path manually in your Zed configuration: | If automatic detection doesn't work, specify the path manually in your Zed configuration: | ||
</translate> | </translate> | ||
<syntaxhighlight lang="json"> | |||
{ | |||
"lsp": { | "lsp": { | ||
"rust-analyzer": { | "rust-analyzer": { | ||
| Line 298: | Line 343: | ||
} | } | ||
} | } | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:30--> | <!--T:30--> | ||
| Line 313: | Line 359: | ||
When you connect to a remote machine, the client either downloads a matching server binary from upstream or pushes a local copy if <code>"upload_binary_over_ssh": true</code> is enabled. Connections fail if the versions diverge. | When you connect to a remote machine, the client either downloads a matching server binary from upstream or pushes a local copy if <code>"upload_binary_over_ssh": true</code> is enabled. Connections fail if the versions diverge. | ||
</translate> | </translate> | ||
<syntaxhighlight lang="nix"> | |||
home.file.".zed_server" = { | |||
source = "${pkgs.zed-editor.remote_server}/bin"; | source = "${pkgs.zed-editor.remote_server}/bin"; | ||
recursive = true; | recursive = true; | ||
}; | }; | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:33--> | <!--T:33--> | ||
| Line 325: | Line 375: | ||
Alternatively, use Home Manager's built-in option for simpler setup: | Alternatively, use Home Manager's built-in option for simpler setup: | ||
</translate> | </translate> | ||
<syntaxhighlight lang="nix">programs.zed-editor = { | |||
enable = true; | enable = true; | ||
installRemoteServer = true; | installRemoteServer = true; | ||
}; | };</syntaxhighlight> | ||
<translate> | <translate> | ||
<!--T:35--> | <!--T:35--> | ||
| Line 344: | Line 396: | ||
==== Preinstall extensions ==== | ==== Preinstall extensions ==== | ||
<syntaxhighlight lang="json"> | |||
{ | |||
"extensions": [ | "extensions": [ | ||
"nix", | "nix", | ||
| Line 351: | Line 404: | ||
] | ] | ||
} | } | ||
</syntaxhighlight> | |||
<translate> | <translate> | ||
<!--T:37--> | <!--T:37--> | ||