about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2021-06-25 11:15:04 +0200
committerGitHub <noreply@github.com>2021-06-25 11:15:04 +0200
commit0b92e6bbccaffc647e947aa0d44bc568aaf0374b (patch)
tree7cfde48282830ae627f492e32cd54705150714a7
parent959014ce29d2057bf14e7ef88461bfeef3015bac (diff)
parentf8e309adc354aa86e01c0ff22b8a2654121df8bd (diff)
Merge pull request #128042 from risicle/ris-dovecot-tests
dovecot: enable tests
-rw-r--r--pkgs/servers/mail/dovecot/default.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/servers/mail/dovecot/default.nix b/pkgs/servers/mail/dovecot/default.nix
index d5fb9e7ed6ee8..6f688996fb048 100644
--- a/pkgs/servers/mail/dovecot/default.nix
+++ b/pkgs/servers/mail/dovecot/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchurl, perl, pkg-config, systemd, openssl
-, bzip2, zlib, lz4, inotify-tools, pam, libcap
+, bzip2, zlib, lz4, inotify-tools, pam, libcap, coreutils
 , clucene_core_2, icu, openldap, libsodium, libstemmer, cyrus_sasl
 , nixosTests
 # Auth modules
@@ -27,9 +27,20 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  preConfigure = ''
+  postPatch = ''
+    sed -i -E \
+      -e 's!/bin/sh\b!${stdenv.shell}!g' \
+      -e 's!([^[:alnum:]/_-])/bin/([[:alnum:]]+)\b!\1${coreutils}/bin/\2!g' \
+      -e 's!([^[:alnum:]/_-])(head|sleep|cat)\b!\1${coreutils}/bin/\2!g' \
+      src/lib-program-client/test-program-client-local.c
+
+    patchShebangs src/lib-smtp/test-bin/*.sh
+    sed -i -s -E 's!\bcat\b!${coreutils}/bin/cat!g' src/lib-smtp/test-bin/*.sh
+
     patchShebangs src/config/settings-get.pl
-  '' + lib.optionalString (stdenv.isLinux) "export systemdsystemunitdir=$out/etc/systemd/system";
+  '' + lib.optionalString stdenv.isLinux ''
+    export systemdsystemunitdir=$out/etc/systemd/system
+  '';
 
   # We need this for sysconfdir, see remark below.
   installFlags = [ "DESTDIR=$(out)" ];
@@ -81,6 +92,8 @@ stdenv.mkDerivation rec {
     ++ lib.optional withPgSQL "--with-pgsql"
     ++ lib.optional withSQLite "--with-sqlite";
 
+  doCheck = !stdenv.isDarwin;
+
   meta = with lib; {
     homepage = "https://dovecot.org/";
     description = "Open source IMAP and POP3 email server written with security primarily in mind";