Neovim in NixOS

I have an existing Lazyvim based Neovim config, from a non-NixOS Distro, for the most part, my Neovim configuration works fine, i.e. Syntax highlighting, etc.

This is what I have been doing so far: (using home manager) & Symlinking my nvim config directory

{
  home-manager.users.usr = { pkgs, ... }: {
    home.file = {
      nvimconfigdir = {
      	enable = true;
        source = "/etc/nixos/pkg/neovim/data/nvim/";
        target = ".config/nvim";
        recursive = true;
      };
      projecthistory = {
        enable = true;
        source = "/etc/nixos/pkg/neovim/data/project_history";
        target = ".local/share/nvim/project_nvim/project_history";
      };
    };

    programs.neovim = {
      enable = true;
      withNodeJs = true;
      withPython3 = true;
      extraPackages = [
        pkgs.vimPlugins.mason-lspconfig-nvim
        pkgs.vimPlugins.mason-tool-installer-nvim
        pkgs.marksman pkgs.cargo
        pkgs.vimPlugins.mason-lspconfig-nvim
        pkgs.lua-language-server
      ];

      viAlias = true;
      vimAlias = true;
    };
  };
}

However, I noticed my LSP servers weren’t working properly & I had to add some packages in extraPackages to stop Mason Compilation errors from constantly showing

I recently checked my :LspInfo & :LspLog & noticed that my LSP clients/ servers weren’t even working, they often had some errors about NixOS dynamically linked exe’s, or weren’t reporting info on their status
I realised that this was caused by NixOS’s lack of FHS & dynamically linked library caveats

TLDR I realised that you cant use LSP stuff OOTB on NixOS, whats the best way to get my existing config working again? What are all of my options?

FYI, i’ve been using Mason for all of my LSP stuff, I also dont want to do too much work like having to reconfigure everything or stop using a neovim distro like Lazyvim

Don’t rely on meson downloading/building LSP-servers, but instead provide them by other means.

I consider it the best, if the LSP-server is provided by the devshell, as this usually gives you the best possible integration.

Ah ok, so lets say I want the nix LSP globally, I would add the nil package to my env.syspkgs
&
If I want an LSP server i.e for nodeJS, I would add that LSP server package to my default.nix devshell file?
Is that all I have to configure?
Thank you for the reply :slight_smile:

I would have all of them in project specific shells. Not some globally and others in a shell.

Even though nil would work “well enough” when installed globally.