Documentation / support for configuring for use with Nixd? #8474
-
Nixd has a number of advantages over the alternative LSPs, like However, when I add this to my languages.toml: [[language]]
name = "nix"
language-servers = [ "nixd" ] It fails silently, and Edit: Note that it does seem to work, at least partially, when I do the following instead of the above conf: [language-server]
nil = { command = "nixd" } I will test further. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 11 replies
-
Support for For instance, jumping to file paths appears to be broken, whereas it works with |
Beta Was this translation helpful? Give feedback.
-
You need to define an entry for [language-server.nixd]
command = ...
args ... |
Beta Was this translation helpful? Give feedback.
-
With the following [[language]]
name = "nix"
language-servers = [ "nixd" ]
[language-server.nixd]
command = "nixd" I am getting this log output when attempting to With the CLI printing in red:
|
Beta Was this translation helpful? Give feedback.
-
With the new release it is now supported? |
Beta Was this translation helpful? Give feedback.
-
works with ❯ nixd --version
nixd, version: 2.1.2 didn't work with |
Beta Was this translation helpful? Give feedback.
-
In case it helps anyone, here's a rendered example of my (working) config for a flake-based NixOS system, which has been working reliably for me for the past couple years: [language-server.nixd]
command = "nixd"
[language-server.nixd.formatting]
command = ["alejandra"]
[language-server.nixd.nixpkgs]
expr = "import (builtins.getFlake \"/etc/nixos\").inputs.nixpkgs { }"
[language-server.nixd.options.nixos]
expr = "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.<HOSTNAME>.options" Substitute for whatever you want. In my case, I use programs.helix.languages = {
language-server.rust-analyzer.config = {
checkOnSave.allTargets = true;
};
language-server.nixd = {
command = "nixd";
formatting = {
command = ["alejandra"];
};
nixpkgs.expr = "import (builtins.getFlake \"/etc/nixos\").inputs.nixpkgs { }";
options.nixos.expr = "(builtins.getFlake \"/etc/nixos\").nixosConfigurations.bld0.options";
}; |
Beta Was this translation helpful? Give feedback.
In case it helps anyone, here's a rendered example of my (working) config for a flake-based NixOS system, which has been working reliably for me for the past couple years:
Substitute for whatever you want. In my case, I use
home-manager
, so I configure it from a home-manager context like so: