I created an issue on the nvim-treesitter tracker but wanted to ask around here as well. I can’t use go.so files compiled through Nix, but things work if let the nvim-treesitter plugin do the compilation in nix-shell -p gcc. Please see the issue for details. I wanted to package the parsers as Vim plugins in Nixpkgs but before that these things should at least work on NixOS
@teto tagging you because I know you use more or less the same combination although you reuse the builtGrammars. Funnily, those too fail for me in the case of Go.
There’s a lockfile where certain working revisions of the parsers are pinned. This helps maintain ABI compatibility. Using the revision from the lockfile for go solved my issue.
dont know for go but I’ve fixed recently (<1 month) C and bash grammars in nixpkgs.
Last week, @vigoux merged a patch in neovim that checks for the treesitter ABI to give nicer error messages.
I am trying to improve the (neo)vim support into nixos. For now it’s easier to rely on modules but eventually I would like to be able to generate a runtime without. Here are some ways to install the grammars in the correct place:
# with home-manager
home.file."${config.xdg.configHome}/nvim/parser/c.so".source = "${pkgs.tree-sitter.builtGrammars.c}/parser";
# when using the new nixos neovim module
runtime."parser/c.so".source = "${pkgs.tree-sitter.builtGrammars.c}/parser";
I’d like to at some point upstream something where nvim-treesitter and the grammars are one derivation that you can configure because there’s a dependency between the parsers and nvim-treesitter. Honestly, there’s even a dependency between nvim-treesitter and neovim as far as I understand it.