How to package language servers with nvim override?

Sorry if this is obvious I am learning nix and struggling to understand how to do this.

I want to install my language servers and package them with my neovim package and then path them using mkWrapper or something. I’ve tried writting a hook but it doesn’t appear to run.

{ neovim, pkgs }:

neovim.override {
  viAlias = true;
  vimAlias = true;
  configure = {
    packages.myPlugins = with pkgs.vimPlugins; {
      start = [ 
    customRC = ''
      lua << EOF
        ${builtins.readFile ./init.lua}

Does anybody know how I can do this?

I think it may be a little easier if you use home-manager, which has programs.neovim.extraPackages.

Although I believe you could simply also add these to your user packages if you’re willing to make them available everywhere in your user’s environment.

    users.users.your-username-goes-here.packages = with pkgs; [
      # Language servers

But FYI, it looks your wrapper is indeed very similar to home-manager.

Could it be that your you’re just forgetting to do the required lua setup for the lspconfig plugin in your init.lua?

Hmm interesting that home manager version can already do it! nd thanks for your help @rehno

My neovim config is definitely right as right now my workaround is just installing things globally while I try and figure out how to do this properly.

I would prefer to not use home manager or globally installing - I’m newish to nix - how would I incorporate make wrapper into my neovim.override?

I don’t want to lead you astray since I haven’t needed to wrap neovim myself but I’ll just mention that your postInstall from before your edit seemed pretty close!

I often find it helpful to search github with language:nix. E.g. some searches like these might turn up something helpful for you

1 Like

Yes i removed the postinstall hook as i took it from another package but never figured out how to integrate it with my overrides package.

That looks helpful i will have a look through the gist searches thanks