How to add nvim-treesitter plugins through hm module in nixos-unstable channel?

Hello, I am trying to use home-manager module to config my neovim and I am using nixos-unstable channel. But when I add nvim-treesitter plugin, I got an error.

Here is the error.

❮ home-manager switch
error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'home-manager-generation'
         whose name attribute is located at /nix/store/4cbg4rsanwlrgpgrw1926lxhy1723k70-source/pkgs/stdenv/generic/make-derivation.nix:536:13

       … while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'
         at /nix/store/4cbg4rsanwlrgpgrw1926lxhy1723k70-source/pkgs/build-support/trivial-builders/default.nix:80:17:
           79|         enableParallelBuilding = true;
           80|         inherit buildCommand name;
             |                 ^
           81|         passAsFile = [ "buildCommand" ] ++ (derivationArgs.passAsFile or [ ]);

       … while evaluating the option `home.file."/home/luke/.local/share/nvim/site/pack/hm".source':

       … while evaluating definitions from `/nix/store/95ri06chrqlrdkk48g8krhyky5ymv7xz-source/modules/misc/xdg.nix':

       … while evaluating the option `xdg.dataFile."nvim/site/pack/hm".source':

       … while evaluating definitions from `/nix/store/95ri06chrqlrdkk48g8krhyky5ymv7xz-source/modules/programs/neovim.nix':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: You cannot include two different versions of nvim-treesitter, perhaps you included a legacy plugin together with a new one?

Here is my configuration.

    neovim = {
      enable = true;
      viAlias = true;
      vimAlias = true;
      defaultEditor = true;
      initLua = lib.fileContents ./init.lua;
      plugins = with pkgs.vimPlugins; [
        nvim-treesitter
        better-escape-nvim
        yazi-nvim
        todo-comments-nvim
        rainbow-delimiters-nvim
        luasnip
        blink-cmp
        telescope-nvim
        nvim-autopairs
        friendly-snippets
        nvim-lspconfig
        mason-nvim
        gitsigns-nvim
        conform-nvim
        which-key-nvim
        nvim-tree-lua
        indent-blankline-nvim
        nvim-web-devicons
        nvzone-minty
        nvzone-menu
        nvzone-volt
        nvchad-ui
        base46
        plenary-nvim
        nvchad
        lazy-nvim
      ];
    };

As you can see, I only added the nvim-treesitter plugin once.

Thanks for replies.

nvchad includes nvim-treesitter so they might be conflicting.

1 Like

After deleted the nvchad plugin, I can add the nvim-treesitter plugin, but how can I add the parser through nix in nvchad plugin?

After change nvchad to

        (nvchad.overrideAttrs {
          dependencies = with self; [
            gitsigns-nvim
            luasnip
            mason-nvim
            nvim-lspconfig
            telescope-nvim
            nvchad-ui
          ];
        })

I can add the nvim-treesitter plugins. Thanks for solve my question.