Override neovim plugin with an overlay

Hello,

im trying to override a neovim plugin with a previous version/own version. But im a bit confused after looking up how the plugins are build. I tried creating a overlay for the luapackage like that:

  (final: prev: {
          lua51Packages = prev.lua51Packages {
              telescope-nvim = prev.lua51Packages.telescope-nvim.overrideAttrs(oa: {
                pname = "telescope.nvim";
                src = prev.fetchFromGitHub {
                  owner = "nvim-telescope";
                  repo = "telescope.nvim";
                  rev = "85922dde3767e01d42a08e750a773effbffaea3e";
                  hash = "";
                };
              });
            };
    })

But thats not even getting build. Would this be even the correct way or is there a better?

I also looked briefly at nixpkgs/doc/languages-frameworks/vim.section.md at 8f3e1f807051e32d8c95cd12b9b421623850a34d · NixOS/nixpkgs · GitHub But that doen’t seem right thing for my problem because it passes the repo of telescope directly to buildNeovimPlugin but buildNeovimPlugin takes the luapackage as input.