anchor.diff:      "--with-ssl=openssl"
       "--with-zlib"
       "--with-bzlib"
  +    "--with-lz4"
       "--with-ldap"
       "--with-lucene"
       "--with-icu"
  
positive.code: }:
  
  stdenv.mkDerivation rec {
    name = "dovecot-2.2.33.2";
  
    nativeBuildInputs = [ perl pkgconfig ];
    buildInputs = [ openssl bzip2 zlib clucene_core_2 icu openldap ]
      ++ lib.optionals (stdenv.isLinux) [ systemd pam libcap inotify-tools ]
      ++ lib.optional withMySQL mysql.connector-c
      ++ lib.optional withPgSQL postgresql
      ++ lib.optional withSQLite sqlite;
  
    src = fetchurl {
      url = "http://dovecot.org/releases/2.2/${name}.tar.gz";
      sha256 = "117f9i62liz2pm96zi2lpldzlj2knzj7g410zhifwmlsc1w3n7py";
    };
  
    preConfigure = ''
  
negative.code:     ++ lib.optional withSQLite "--with-sqlite";
  
    meta = {
      homepage = https://dovecot.org/;
      description = "Open source IMAP and POP3 email server written with security primarily in mind";
      maintainers = with stdenv.lib.maintainers; [ viric peti rickynils fpletz ];
      platforms = stdenv.lib.platforms.unix;
    };
  }
  