neovimUtils.packDir: init: extend vimUtils.packDir

in order for neovim to catch plugins dependencies, we fork
vimUtils.packDir as `neovimUtils.packDir` to merge the various plugins
nix-support/propagated-build-inputs files in the packDir derivation
$out/nix-support/propagated-build-inputs where there was previously
none.

Having a fork allows us to experiment without impacting vim plugins.

Once we are more confident this doesn't break stuff and/or the
implementation is final, we can merge the fork back or replace one by
the other.
This commit is contained in:
Matthieu C.
2024-06-12 15:07:03 +02:00
parent 6fe1fd5421
commit 390ca00b5b
2 changed files with 32 additions and 3 deletions
@@ -229,12 +229,36 @@ let
ln -s ${grammar}/parser $out/parser/${name}.so
'');
/*
Fork of vimUtils.packDir that additionnally generates a propagated-build-inputs-file that
can be used by the lua hooks to generate a proper LUA_PATH
Generates a packpath folder as expected by vim
Example:
packDir ( {myVimPackage = { start = [ vimPlugins.vim-fugitive ]; opt = []; }; })
=> "/nix/store/xxxxx-pack-dir"
*/
packDir = packages:
let
rawPackDir = vimUtils.packDir packages;
in
rawPackDir.override ({
postBuild = ''
mkdir $out/nix-support
for i in $(find -L $out -name propagated-build-inputs ); do
cat "$i" >> $out/nix-support/propagated-build-inputs
done
'';});
in
{
inherit makeNeovimConfig;
inherit generateProviderRc;
inherit legacyWrapper;
inherit grammarToPlugin;
inherit packDir;
inherit buildNeovimPlugin;
buildNeovimPluginFrom2Nix = lib.warn "buildNeovimPluginFrom2Nix was renamed to buildNeovimPlugin" buildNeovimPlugin;
+8 -3
View File
@@ -24,6 +24,8 @@ let
, withNodeJs ? false
, withPerl ? false
, rubyEnv ? null
# wether to create symlinks in $out/bin/vi(m) -> $out/bin/nvim
, vimAlias ? false
, viAlias ? false
@@ -45,6 +47,8 @@ let
stdenv.mkDerivation (finalAttrs:
let
finalPackdir = neovimUtils.packDir packpathDirs;
rcContent = ''
${luaRcContent}
'' + lib.optionalString (!isNull neovimRcContent) ''
@@ -58,9 +62,10 @@ let
[
"--add-flags" ''--cmd "lua ${providerLuaRc}"''
# (lib.intersperse "|" hostProviderViml)
] ++ lib.optionals (packpathDirs.myNeovimPackages.start != [] || packpathDirs.myNeovimPackages.opt != []) [
"--add-flags" ''--cmd "set packpath^=${vimUtils.packDir packpathDirs}"''
"--add-flags" ''--cmd "set rtp^=${vimUtils.packDir packpathDirs}"''
]
++ lib.optionals (packpathDirs.myNeovimPackages.start != [] || packpathDirs.myNeovimPackages.opt != []) [
"--add-flags" ''--cmd "set packpath^=${finalPackdir}"''
"--add-flags" ''--cmd "set rtp^=${finalPackdir}"''
]
;