Merge pull request #308348 from RyanGibb/notmuch-vim

notmuch: install the vim plugin

authored by Doron Behar and committed by GitHub 3f709516 3f855a3d

+28 -9
+28 -9
pkgs/applications/networking/mailreaders/notmuch/default.nix
··· 1 - { fetchurl, lib, stdenv, makeWrapper 1 + { fetchurl, lib, stdenv, makeWrapper, buildEnv 2 2 , pkg-config, gnupg 3 3 , xapian, gmime3, sfsexp, talloc, zlib 4 4 , doxygen, perl, texinfo ··· 12 12 , withEmacs ? true 13 13 , withRuby ? true 14 14 , withSfsexp ? true # also installs notmuch-git, which requires sexp-support 15 + , withVim ? true 15 16 }: 16 17 17 - stdenv.mkDerivation rec { 18 + stdenv.mkDerivation (finalAttrs: { 18 19 pname = "notmuch"; 19 20 version = "0.38.3"; 20 21 21 22 src = fetchurl { 22 - url = "https://notmuchmail.org/releases/notmuch-${version}.tar.xz"; 23 + url = "https://notmuchmail.org/releases/notmuch-${finalAttrs.version}.tar.xz"; 23 24 hash = "sha256-mvRsyA2li0MByiuu/MJaQNES0DFVB+YywPPw8IMo0FQ="; 24 25 }; 25 26 ··· 76 77 ''; 77 78 78 79 outputs = [ "out" "man" "info" "bindingconfig" ] 79 - ++ lib.optional withEmacs "emacs" 80 - ++ lib.optional withRuby "ruby"; 80 + ++ lib.optional withEmacs "emacs"; 81 81 82 82 # if notmuch is built with s-expression support, the testsuite (T-850.sh) only 83 83 # passes if notmuch-git can be executed, so we need to patch its shebang. ··· 123 123 moveToOutput bin/notmuch-emacs-mua $emacs 124 124 '' + lib.optionalString withRuby '' 125 125 make -C bindings/ruby install \ 126 - vendordir=$ruby/lib/ruby \ 126 + vendordir=$out/lib/ruby \ 127 127 SHELL=$SHELL \ 128 128 $makeFlags "''${makeFlagsArray[@]}" \ 129 129 $installFlags "''${installFlagsArray[@]}" ··· 133 133 + lib.optionalString withSfsexp '' 134 134 cp notmuch-git $out/bin/notmuch-git 135 135 wrapProgram $out/bin/notmuch-git --prefix PATH : $out/bin:${lib.getBin git}/bin 136 + '' + lib.optionalString withVim '' 137 + make -C vim DESTDIR="$out/share/vim-plugins/notmuch" prefix="" install 138 + mkdir -p $out/share/nvim 139 + ln -s $out/share/vim-plugins/notmuch $out/share/nvim/site 140 + '' + lib.optionalString (withVim && withRuby) '' 141 + PLUG=$out/share/vim-plugins/notmuch/plugin/notmuch.vim 142 + cat >> $PLUG << EOF 143 + let \$GEM_PATH=\$GEM_PATH . ":${finalAttrs.passthru.gemEnv}/${ruby.gemPath}" 144 + let \$RUBYLIB=\$RUBYLIB . ":$out/${ruby.libPath}/${ruby.system}" 145 + if has('nvim') 146 + EOF 147 + for gem in ${finalAttrs.passthru.gemEnv}/${ruby.gemPath}/gems/*/lib; do 148 + echo "ruby \$LOAD_PATH.unshift('$gem')" >> $PLUG 149 + done 150 + echo 'endif' >> $PLUG 136 151 ''; 137 152 138 153 passthru = { 139 - pythonSourceRoot = "notmuch-${version}/bindings/python"; 154 + pythonSourceRoot = "notmuch-${finalAttrs.version}/bindings/python"; 155 + gemEnv = buildEnv { 156 + name = "notmuch-vim-gems"; 157 + paths = with ruby.gems; [ mail ]; 158 + pathsToLink = [ "/lib" "/nix-support" ]; 159 + }; 140 160 tests.version = testers.testVersion { package = notmuch; }; 141 - inherit version; 142 161 143 162 updateScript = gitUpdater { 144 163 url = "https://git.notmuchmail.org/git/notmuch"; ··· 155 174 platforms = platforms.unix; 156 175 mainProgram = "notmuch"; 157 176 }; 158 - } 177 + })