Nvim-treesitter grammars not linked from nix store

Hi! I’ve been trying to configure neovim for some time now and have come into a problem involving getting treesitter to work. I’m using nix-wrapper-modules to configure it.

my module.nix:

{ pkgs, wlib, ... }:
{
  imports = [
    wlib.wrapperModules.neovim
  ];

  settings.config_directory = /etc/nixos/wrapper-modules/neovim;

  specs.general = {
    lazy = false;
    data = with pkgs.vimPlugins; [
      guess-indent-nvim
      rainbow
      auto-pairs
      telescope-nvim
      telescope-fzf-native-nvim
      nvim-treesitter.withAllGrammars
      smear-cursor-nvim
      nvim-web-devicons
      nvim-tree-lua
      diffview-nvim
    ];  
  };

  runtimePkgs = with pkgs; [
    ripgrep
    fd
    tree-sitter
  ];
}

I can confirm the packages are installed in the nix store, they have names like nvim-treesitter-grammar-*. Running :checkhealth nvim-treesitter shows no languages installed, since the /.local/share/nvim/site/{parser/queries}/ folders are empty. I have looked at similar issues here, and one of the solutions is to create a symlink by using the xdg.configFile option, but this seems to be available only with home manager. Is there a way to do something similar without it?

I don’t use nix-wrapper-modules so not sure on that, but just for the adding treesitters into PATH part, I do this to add all treesitter grammars without home manager.

let
  treesitterGrammars = pkgs.symlinkJoin {
    name = "nvim-treesitter-grammars";
    paths = pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies;
  };
in
{
  programs.neovim = {
    enable = true;
    viAlias = true;
    vimAlias = true;
    defaultEditor = true;
    runtime = {
      "lua/lazy".source = "${pkgs.vimPlugins.lazy-nvim}/lua/lazy";
      "parser".source = "${treesitterGrammars}/parser";
      "queries".source = "${treesitterGrammars}/queries";
    };
  };
}

Neovim searches runtime for parsers and queries, so I just symlinked everything in there. Probably prone to breakage though if nix treesitter maintainers ever change how withAllGrammars is defined.