Plugins for neovim are not installed for neovim-qt

Is this a missing feature? I’m trying to port my neovim configuration over to home-manager.

I installed my lua configuration modules into the XDG config dir. Neovim and neovide have no problem loading them, but neovim-qt is being loaded without the packpath set to include the plugins so my configuration scripts error-out on startup.

This seems to be a nixpkgs problem rather than a home-manager problem.

That’s a mismatch of your concept and neovim-qt’s. I think you want something like

neovim-qt = neovim-qt.override { inherit (myPackages) neovim; };

(I’m using something like this)

I had a PR for home-manager that would put the plugins into the standard packpath. we had to revert it because the wrapper would load the path twice. I am working towards a solution to restore that PR in which case you shouldn’t see that problem anymore.

Ok I’ve been digging into this a bit more, and my main takeaway, is that if I’m using home-manager I shouldn’t using traditional vim or lua configuration files, I should be doing everything through programs.neovim.plugins.<plugin>.config and programs.neovim.extraConfig.

The reasons these neovim plugins don’t load in neovim-qt is because neovim is wrapped here with the config options and all the paths to the plugins. neovim-qt can’t touch the plugins, because it doesn’t get the paths.

So the question is how to share the same setup between neovim and neovim-qt.

I could override programs.neovim.package with pkgs.neovim-qt-unwrapped. neovim-qt would then be correctly configured, but not the terminal version of neovim.

I don’t see how I can get home-manager to wrap both neovim and neovim-qt.

try with wthis one programs.neovim: link packpath dir in XDG_DATA_HOME by teto · Pull Request #3717 · nix-community/home-manager · GitHub , it was reverted later because of some issues but I will reenalbe it later. You could also try to wrap neovim-qt the same way neovim is there is a function wrapNeovim.

What goes in place of (myPackages)? Is it a list of the additional packages installed with extraPackages in the programs.neovim configuration?

The name of the attribute set that contains neovim. That depends on context, usually inherit (pkgs) neovim I think.

EDIT: but really, I don’t know home manager and I don’t expect it will work there as is, because here you’d need to refer to the variant of neovim that already has all your plugins and settings. I’ve been using just simple overlays or packageOverrides for configuring neovim and others.

Does a neovim overlay allow for declaring the plugins that should be preinstalled and lua files to run? I’m new to overlays. I know that the arguments of the neovim definition in nixpkgs can be changed but am not aware of what else can.

Yes, it allows overriding any parameters of any packages. And neovim expression does expose the config and plugins to override. Though I expect it won’t be as nice and comfortable as with the specialized interface in home manager.

Hi, I had the same issue and I solved it like this:

home.packages = with pkgs; [
    (neovim-qt.override { neovim = config.programs.neovim.finalPackage; })
];
3 Likes

Wow - it works! Amazing! Thank you.

It should be possible to abstract this into a configuration option of the neovim module:

programs.neovim = {
  enable = true;
  enable-qt = true;
  ...
};

Does anyone know how can such change be proposed?