From 8968092456edd0429a5a5e5de5d178e190f89698 Mon Sep 17 00:00:00 2001 From: teto <886074+teto@users.noreply.github.com> Date: Sat, 17 Jan 2026 00:54:18 +0100 Subject: [PATCH] neovim: move plugins where expected so we dont have to add some nix store path to rtp in the wrapper. Makes the setup more in line with what neovim users are used to. Also it means other neovim GUIs can see the plugins without wrapping. A first version of this PR conflicted with existing ~/.local/share/nvim/site folders but this should be fine as it makes only a subfolder readonly. I am able to mix rocks.nvim/vim.pack vim packages along with the home-manager one for instance. --- .../misc/news/2026/01/2026-01-19_02-17-02.nix | 8 ++++++ modules/programs/neovim.nix | 27 +++++++++---------- 2 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 modules/misc/news/2026/01/2026-01-19_02-17-02.nix diff --git a/modules/misc/news/2026/01/2026-01-19_02-17-02.nix b/modules/misc/news/2026/01/2026-01-19_02-17-02.nix new file mode 100644 index 00000000..c8bc5830 --- /dev/null +++ b/modules/misc/news/2026/01/2026-01-19_02-17-02.nix @@ -0,0 +1,8 @@ +{ config, ... }: +{ + time = "2026-01-19T01:17:02+00:00"; + condition = config.programs.neovim.enable; + message = '' + The neovim module now symlinks its plugins into xdg.dataFile."nvim/site/pack/hm" ( ~/.local/share/nvim) instead of modifying the runtimepath via wrapper arguments. + ''; +} diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index a745c254..086390fd 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -437,16 +437,6 @@ in vimPackageInfo = neovimUtils.makeVimPackageInfo (map suppressNotVimlConfig pluginsNormalized); - packpathDirs.hm = vimPackageInfo.vimPackage; - finalPackdir = neovimUtils.packDir packpathDirs; - - packpathWrapperArgs = lib.optionals (packpathDirs.hm.start != [ ] || packpathDirs.hm.opt != [ ]) [ - "--add-flags" - ''--cmd "set packpath^=${finalPackdir}"'' - "--add-flags" - ''--cmd "set rtp^=${finalPackdir}"'' - ]; - wrappedNeovim' = pkgs.wrapNeovimUnstable cfg.package { withNodeJs = cfg.withNodeJs || cfg.coc.enable; plugins = [ ]; @@ -466,11 +456,7 @@ in ps: (cfg.extraPython3Packages ps) ++ (lib.concatMap (f: f ps) vimPackageInfo.pluginPython3Packages); neovimRcContent = cfg.extraConfig; wrapperArgs = - cfg.extraWrapperArgs - ++ extraMakeWrapperArgs - ++ extraMakeWrapperLuaCArgs - ++ extraMakeWrapperLuaArgs - ++ packpathWrapperArgs; + cfg.extraWrapperArgs ++ extraMakeWrapperArgs ++ extraMakeWrapperLuaCArgs ++ extraMakeWrapperLuaArgs; wrapRc = false; }; in @@ -531,6 +517,17 @@ in )) ]; + # link the packpath in expected folder so that even unwrapped neovim can pick + # home-manager's plugins + xdg.dataFile."nvim/site/pack/hm" = + let + packpathDirs.hm = vimPackageInfo.vimPackage; + in + { + enable = allPlugins != [ ]; + source = "${pkgs.neovimUtils.packDir packpathDirs}/pack/hm"; + }; + xdg.configFile = lib.mkMerge ( # writes runtime (map (x: x.runtime) pluginsNormalized)