notmuch: move the vim plugin to another output

I wondered why my neovim was slow. Turned out notmuch.vim loading took >
500ms to load (ruby and all). And I dont even use it !
I suspect the plugin could be improved to lazyload more stuff but I
think it's ok to have the vim plugin installer be a user decision as well.
I moved it to a new "vim" output : you can install the plugin via
"notmuch.vim"
This commit is contained in:
Matthieu C. 2024-11-03 17:55:34 +01:00
parent a113a85dfa
commit 0082fde43d
3 changed files with 16 additions and 6 deletions

View file

@ -27,6 +27,11 @@
[v1.7.0](https://github.com/jtroo/kanata/releases/tag/v1.7.0)
for more information.
- the notmuch vim plugin now lives in a separate output of the `notmuch`
package. Installing `notmuch` will not bring the notmuch vim package anymore,
add `vimPlugins.notmuch-vim` to your (Neo)vim configuration if you want the
vim plugin.
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
## Other Notable Changes {#sec-release-25.05-notable-changes}

View file

@ -38,6 +38,7 @@
languagetool,
llvmPackages,
meson,
notmuch,
neovim-unwrapped,
nim1,
nodePackages,
@ -1780,6 +1781,8 @@ in
nvimRequireCheck = "null-ls";
};
notmuch-vim = notmuch.vim;
NotebookNavigator-nvim = super.NotebookNavigator-nvim.overrideAttrs {
nvimRequireCheck = "notebook-navigator";
};

View file

@ -11,6 +11,7 @@
, withEmacs ? true
, withRuby ? true
, withSfsexp ? true # also installs notmuch-git, which requires sexp-support
# TODO upstream: it takes too long ! 800 ms here
, withVim ? true
}:
@ -76,7 +77,8 @@ stdenv.mkDerivation (finalAttrs: {
'';
outputs = [ "out" "man" "info" "bindingconfig" ]
++ lib.optional withEmacs "emacs";
++ lib.optional withEmacs "emacs"
++ lib.optional withVim "vim";
# if notmuch is built with s-expression support, the testsuite (T-850.sh) only
# passes if notmuch-git can be executed, so we need to patch its shebang.
@ -133,14 +135,14 @@ stdenv.mkDerivation (finalAttrs: {
cp notmuch-git $out/bin/notmuch-git
wrapProgram $out/bin/notmuch-git --prefix PATH : $out/bin:${lib.getBin git}/bin
'' + lib.optionalString withVim ''
make -C vim DESTDIR="$out/share/vim-plugins/notmuch" prefix="" install
mkdir -p $out/share/nvim
ln -s $out/share/vim-plugins/notmuch $out/share/nvim/site
make -C vim DESTDIR="$vim/share/vim-plugins/notmuch" prefix="" install
mkdir -p $vim/share/nvim
ln -s $vim/share/vim-plugins/notmuch $vim/share/nvim/site
'' + lib.optionalString (withVim && withRuby) ''
PLUG=$out/share/vim-plugins/notmuch/plugin/notmuch.vim
PLUG=$vim/share/vim-plugins/notmuch/plugin/notmuch.vim
cat >> $PLUG << EOF
let \$GEM_PATH=\$GEM_PATH . ":${finalAttrs.passthru.gemEnv}/${ruby.gemPath}"
let \$RUBYLIB=\$RUBYLIB . ":$out/${ruby.libPath}/${ruby.system}"
let \$RUBYLIB=\$RUBYLIB . ":$vim/${ruby.libPath}/${ruby.system}"
if has('nvim')
EOF
for gem in ${finalAttrs.passthru.gemEnv}/${ruby.gemPath}/gems/*/lib; do