Language server not found on NixOS

What happened?

In init.el i set (lua +lsp) and (python +lsp). In NixOS i installed the corresponding lua-language-server and python-language-server. I can start both of them in the terminal, so they are installed correctly.

Due to the peculiarities of NixOS, i have to tell Emacs where to look for the language server bin. I tried each of the following settings:

However, with each setting (only one enabled at a time), emacs tells me that the language server could not be found and offers to install a language server, which doesn’t work on NixOS.

The only exception is (setq lsp-python-ms-executable (executable-find "python-language-server")) which is straight from the installation instructions for the package and yields:

The strange thing is, that it worked in the past for lua-language-server with the setting shown in the first screenshot (didn’t try python at the time). I then uninstalled the modules and packages for a few weeks and now it doesn’t work anymore.

What did you expect to happen?

Emacs should connect to the language servers.

Steps to reproduce

System information

Loading data dump...

Hello! Not sure if I can help here, but did you try to run doom env to update your environment before starting Doom Emacs? For me language servers work without trouble when the environment is up to date (I reiusse doom env after updating NixOS). Also, you may be interested in nix-direnv together with envrc-mode.

Thank you for the suggestion.

The envvars file is up to date and sadly doesn’t solve the problem (i had to enable the use of the envvars file when migrating to NixOS because it wouldn’t really work without it).

I now migrated to (python +lsp +pyright) which works out of the box because emacs has no trouble finding NodeJS modules on NixOS somehow.

Solved: i switched to (lsp +eglot) and eglot finds the lua-language-server. However, with eglot it sometimes takes around 10 seconds to save a .lua file, which didn’t happen before…

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.