From 39b74baeb3ee893b887d3d866bb423b89845e992 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Fri, 23 Oct 2020 18:11:55 +0200 Subject: [PATCH 1/3] notmuch: install the vim plugin Install the vim plugin to $out/share/vim-plugins/notmuch and $out/share/nvim/site/plugin/notmuch.vim. It is only static files and doesn't add any dependency so it is enabled by default. Add `withVim` argument to override this. Co-authored-by: Jules Aguillon --- pkgs/applications/networking/mailreaders/notmuch/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/applications/networking/mailreaders/notmuch/default.nix b/pkgs/applications/networking/mailreaders/notmuch/default.nix index ba2f75669847..ed1cf3b622ee 100644 --- a/pkgs/applications/networking/mailreaders/notmuch/default.nix +++ b/pkgs/applications/networking/mailreaders/notmuch/default.nix @@ -12,6 +12,7 @@ , withEmacs ? true , withRuby ? true , withSfsexp ? true # also installs notmuch-git, which requires sexp-support +, withVim ? true }: stdenv.mkDerivation rec { @@ -133,6 +134,10 @@ stdenv.mkDerivation rec { + lib.optionalString withSfsexp '' 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 ''; passthru = { From ea85f8e80ca240eb0378114d5fce92a20501d85c Mon Sep 17 00:00:00 2001 From: Ryan Gibb Date: Thu, 2 May 2024 13:40:58 +0100 Subject: [PATCH 2/3] notmuch: use finalAttrs Co-authored-by: Doron Behar --- .../networking/mailreaders/notmuch/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/networking/mailreaders/notmuch/default.nix b/pkgs/applications/networking/mailreaders/notmuch/default.nix index ed1cf3b622ee..9722d70f2d69 100644 --- a/pkgs/applications/networking/mailreaders/notmuch/default.nix +++ b/pkgs/applications/networking/mailreaders/notmuch/default.nix @@ -15,12 +15,12 @@ , withVim ? true }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "notmuch"; version = "0.38.3"; src = fetchurl { - url = "https://notmuchmail.org/releases/notmuch-${version}.tar.xz"; + url = "https://notmuchmail.org/releases/notmuch-${finalAttrs.version}.tar.xz"; hash = "sha256-mvRsyA2li0MByiuu/MJaQNES0DFVB+YywPPw8IMo0FQ="; }; @@ -141,9 +141,8 @@ stdenv.mkDerivation rec { ''; passthru = { - pythonSourceRoot = "notmuch-${version}/bindings/python"; + pythonSourceRoot = "notmuch-${finalAttrs.version}/bindings/python"; tests.version = testers.testVersion { package = notmuch; }; - inherit version; updateScript = gitUpdater { url = "https://git.notmuchmail.org/git/notmuch"; @@ -160,4 +159,4 @@ stdenv.mkDerivation rec { platforms = platforms.unix; mainProgram = "notmuch"; }; -} +}) From 590bccee5de135fba2a5504df771d899ce7e895a Mon Sep 17 00:00:00 2001 From: Ryan Gibb Date: Wed, 1 May 2024 21:32:38 +0100 Subject: [PATCH 3/3] notmuch: vim ruby bindings and gems We removed the ruby output so we will be able to reference the ruby files from the vim plugin, which is in $out. If we try to reference $ruby from $out we get a cyclic dependency. --- .../mailreaders/notmuch/default.nix | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/mailreaders/notmuch/default.nix b/pkgs/applications/networking/mailreaders/notmuch/default.nix index 9722d70f2d69..588cd4326a61 100644 --- a/pkgs/applications/networking/mailreaders/notmuch/default.nix +++ b/pkgs/applications/networking/mailreaders/notmuch/default.nix @@ -1,4 +1,4 @@ -{ fetchurl, lib, stdenv, makeWrapper +{ fetchurl, lib, stdenv, makeWrapper, buildEnv , pkg-config, gnupg , xapian, gmime3, sfsexp, talloc, zlib , doxygen, perl, texinfo @@ -77,8 +77,7 @@ stdenv.mkDerivation (finalAttrs: { ''; outputs = [ "out" "man" "info" "bindingconfig" ] - ++ lib.optional withEmacs "emacs" - ++ lib.optional withRuby "ruby"; + ++ lib.optional withEmacs "emacs"; # 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. @@ -124,7 +123,7 @@ stdenv.mkDerivation (finalAttrs: { moveToOutput bin/notmuch-emacs-mua $emacs '' + lib.optionalString withRuby '' make -C bindings/ruby install \ - vendordir=$ruby/lib/ruby \ + vendordir=$out/lib/ruby \ SHELL=$SHELL \ $makeFlags "''${makeFlagsArray[@]}" \ $installFlags "''${installFlagsArray[@]}" @@ -138,10 +137,26 @@ stdenv.mkDerivation (finalAttrs: { 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 + '' + lib.optionalString (withVim && withRuby) '' + PLUG=$out/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}" + if has('nvim') + EOF + for gem in ${finalAttrs.passthru.gemEnv}/${ruby.gemPath}/gems/*/lib; do + echo "ruby \$LOAD_PATH.unshift('$gem')" >> $PLUG + done + echo 'endif' >> $PLUG ''; passthru = { pythonSourceRoot = "notmuch-${finalAttrs.version}/bindings/python"; + gemEnv = buildEnv { + name = "notmuch-vim-gems"; + paths = with ruby.gems; [ mail ]; + pathsToLink = [ "/lib" "/nix-support" ]; + }; tests.version = testers.testVersion { package = notmuch; }; updateScript = gitUpdater {