How to install nushell treesitter grammar?

I see there is a nushell treesitter grammar available. How would I actually install it? It’s not included in pkgs.vimPlugins.nvim-treesitter.withAllGrammars I assume because it’s not officially supported by treesitter yet. The Nixos wiki mentions

Note that the upstream versions of tree-sitter grammars (available under tree-sitter.builtGrammars) are not necessarily compatible with neovim, as nvim-treesitter has its own lockfile to determine compatible grammars. These can be accessed with vimPlugins.nvim-treesitter.builtGrammars

But it doesn’t actually say how to use .builtGrammars and I’m not sure on what syntax is needed. My relevant nix config:

...
    neovim = {
      enable = true;
      defaultEditor = true;
      viAlias = true;
      vimAlias = true;
      configure= {
        customRC = ''
          colorscheme tokyonight
          hi Normal guibg=NONE ctermbg=NONE
          try
            source ~/.config/nvim/init.lua
          catch
          endtry
          try
            source ~/.config/nvim/init.vim
          catch
          endtry
          source ~/.config/nvim/nu.lua
        '';
        packages.myVimPackage = with pkgs.vimPlugins; {
          start = [
            tokyonight-nvim
            nvim-lspconfig
            nvim-treesitter.withAllGrammars
          ];
        };
      };
...
1 Like

Did you try to add the one for nu as well?

        packages.myVimPackage = with pkgs.vimPlugins; {
          start = [
            tokyonight-nvim
            nvim-lspconfig
            nvim-treesitter.withAllGrammars
+           tree-sitter-grammars.tree-sitter-nu
          ];
        };

Perhaps nvim-treesitter.withAllGrammars doesn’t include it?

Edit: I found a config on GitHub which does it like this:

1 Like