From 0082fde43de47be45a7b2daf7dcba9347f4f489c Mon Sep 17 00:00:00 2001 From: "Matthieu C." <886074+teto@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:55:34 +0100 Subject: [PATCH] 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" --- nixos/doc/manual/release-notes/rl-2505.section.md | 5 +++++ .../applications/editors/vim/plugins/overrides.nix | 3 +++ .../networking/mailreaders/notmuch/default.nix | 14 ++++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index b18dbef5fe7f..e98511c2c243 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -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. + ## Other Notable Changes {#sec-release-25.05-notable-changes} diff --git a/pkgs/applications/editors/vim/plugins/overrides.nix b/pkgs/applications/editors/vim/plugins/overrides.nix index 7a299f346a4c..51e939072b2b 100644 --- a/pkgs/applications/editors/vim/plugins/overrides.nix +++ b/pkgs/applications/editors/vim/plugins/overrides.nix @@ -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"; }; diff --git a/pkgs/applications/networking/mailreaders/notmuch/default.nix b/pkgs/applications/networking/mailreaders/notmuch/default.nix index b70512a9d151..e3b6d3a2bdef 100644 --- a/pkgs/applications/networking/mailreaders/notmuch/default.nix +++ b/pkgs/applications/networking/mailreaders/notmuch/default.nix @@ -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