[nvim][tree-sitter] Error during "tree-sitter build": Could not start dynamically linked executable: tree-sitter

Hi,

I’m quite new to NixOS so bear with me :slight_smile:

I’ve installed nvim and tree-sitter like this:

(with pkgs-unstable; [
        nixfmt
        statix
        rustup
        darktable
        neovim
        neovide
        tree-sitter
      ]);

and each time opening nvim I get this kind of error for plenty grammars

15:49:31 msg_show.echomsg [nvim-treesitter/install/c] error: Error during "tree-sitter build": Could not start dynamically linked executable: tree-sitter
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

I just want to reuse my existing nvim config (using LazyVim.org)

What am I missing?

Did you open this link and read the documentation about nix-ld?

Thanks for your answer!

I did, but it sounded like a strange path to follow as I installed tree-sitter from nixpkgs

The problem isn’t with tree-sitter itself, but with how NixOS works. nix-ld allows you to specify libraries that should be available for all dynamically-linked software that requires those libraries. Please read the documentation again, enable nix-ld and see if it fixes your problem. If it doesn’t you’ll need to add more libraries to nix-ld which is also shown in the documentation.

1 Like

But that’s not the nix solution, is it? I suspect lunar vim is pulling its own version of tree-sitter in. So a proper way would be to try to get it to not do that rather than enabling nixld.

so far it works with nix-ld, I’ll study the nixvim way later :slight_smile:

The Nix way would be to declare the Neovim configuration either system-wide, or with home-manager. Both of these require more tinkering, debugging, and figuring out how to properly declare a working Neovim config that matches the one that’s already there.

We have some examples on the Wiki as well Neovim - Official NixOS Wiki

nix-ld is there for a reason and here we have one of them.

1 Like