about summary refs log tree commit diff
path: root/pkgs/applications/networking/mailreaders
diff options
context:
space:
mode:
authorapfelkuchen06 <apfelkuchen@hrnz.li>2023-07-01 17:37:10 +0200
committerapfelkuchen06 <apfelkuchen@hrnz.li>2023-07-03 01:59:03 +0200
commit7656e2149d4d3618c301f97d7e7b2dc33c7d6a70 (patch)
tree2c9cc653ed8ed78c5e52c388fb05903a4608cffe /pkgs/applications/networking/mailreaders
parent3c79393a8fc8e31876efd93202f33c23c782410f (diff)
notmuch: add support for sexp queries
This adds support for queries using s-expressions like
`notmuch search --query=sexp -- '(and (from foo) (subject bar))'`.

Adding git to `nativeCheckInputs` and patching the shebang of notmuch-git is
neccessary to make the test `T850-git.sh` pass. This test was previously skipped
because notmuch-git requires the s-expression feature.
Diffstat (limited to 'pkgs/applications/networking/mailreaders')
-rw-r--r--pkgs/applications/networking/mailreaders/notmuch/default.nix19
1 files changed, 15 insertions, 4 deletions
diff --git a/pkgs/applications/networking/mailreaders/notmuch/default.nix b/pkgs/applications/networking/mailreaders/notmuch/default.nix
index 125b781512e79..4ef0dd046d295 100644
--- a/pkgs/applications/networking/mailreaders/notmuch/default.nix
+++ b/pkgs/applications/networking/mailreaders/notmuch/default.nix
@@ -1,15 +1,16 @@
 { fetchurl, lib, stdenv
 , pkg-config, gnupg
-, xapian, gmime3, talloc, zlib
+, xapian, gmime3, sfsexp, talloc, zlib
 , doxygen, perl, texinfo
 , notmuch
 , pythonPackages
 , emacs
 , ruby
 , testers
-, which, dtach, openssl, bash, gdb, man
+, which, dtach, openssl, bash, gdb, man, git
 , withEmacs ? true
 , withRuby ? true
+, withSfsexp ? true
 }:
 
 stdenv.mkDerivation rec {
@@ -35,7 +36,8 @@ stdenv.mkDerivation rec {
     xapian gmime3 talloc zlib  # dependencies described in INSTALL
     perl
     pythonPackages.python
-  ] ++ lib.optional withRuby ruby;
+  ] ++ lib.optional withRuby ruby
+    ++ lib.optional withSfsexp sfsexp;
 
   postPatch = ''
     patchShebangs configure test/
@@ -75,6 +77,12 @@ stdenv.mkDerivation rec {
     ++ lib.optional withEmacs "emacs"
     ++ lib.optional withRuby "ruby";
 
+  # 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.
+  postBuild = lib.optionalString withSfsexp ''
+    patchShebangs notmuch-git
+  '';
+
   preCheck = let
     test-database = fetchurl {
       url = "https://notmuchmail.org/releases/test-databases/database-v1.tar.xz";
@@ -94,7 +102,10 @@ stdenv.mkDerivation rec {
   nativeCheckInputs = [
     which dtach openssl bash
     gdb man emacs
-  ];
+  ]
+  # for the test T-850.sh for notmuch-git, which is skipped when notmuch is
+  # built without sexp-support
+  ++ lib.optional withSfsexp git;
 
   installTargets = [ "install" "install-man" "install-info" ];