Hey there I am having trouble with setting up the Neovim plugin mason-lspconfig.nvim.
I am following a tutorial series by “Typecraft” for setting up NeoVim, and I am stuck figuring out how to get the LSP working properly:
When I add an LSP server such as:
ensure_installed = {"lua_ls"},
The system prompts with the error:
[ERROR][2024-07-24 23:44:44] .../vim/lsp/rpc.lua:770 "rpc" "/home/technicus/.local/share/nvim/mason/bin/lua-language-server" "stderr" "Could not start dynamically linked executable: /home/technicus/.local/share/nvim/mason/packages/lua-language-server/libexec/bin/lua-language-server\nNixOS cannot run dynamically linked executables intended for generic\nlinux environments out of the box. For more information, see:\nhttps://nix.dev/permalink/stub-ld\n"
While trying to figure out why I learned:
“NixOS cannot run dynamically linked executables intended for generic Linux environments out of the box. This is because, by design, it does not have a global library path, nor does it follow the Filesystem Hierarchy Standard (FHS).” → How to run non-nix executables?
Then I found the package lua-language-server and added it to the NixOS config:
environment.systemPackages = [ pkgs.lua-language-server ];
The NeoVim plugin mason-lspconfig.nvim works after adding lua-language-server to the Nix config.
Then I add more LSP servers in the Neovim config to see what would happen:
ensure_installed = {"lua_ls", "jsonls", "jsonnet_ls", "biome"},
The result is more errors for what appears to be the same reason as before:
[ERROR Thu 25 Jul 2024 11:50:10 AM CDT] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:249: Installation failed for Package(name=biome) error=spawn: npm failed with exit code - and signal -. npm is not executable
I am having trouble finding the language server packages to add in the NixOS config, and this is not the seamless solution the plugin is designed for.
The plugin has an option: auto_install = true, which allows the plugin to install whatever LSP there is that supports the language without any additional intervention, which is dynamic and ideal.
The ultimate solution for this extra layer of abstraction would not require me to look up the package and install it in the NixOS config, and I could natively install the LSPs and any other plugin without additional steps.
– I am following the typecraft guide.
– What is “The Ultimate Solution”?
– How do I implement it?
– Do I need to have a fundamentally different mindset and strategy for setting this up?
– Thanks for your recommendations, guidance, advice, suggestion, assistance, and help.