Dovecot implements Sieve via the dovecot_pigeonhole package. Within pigeonhole there is “sieve-test”, which can evaluate your Sieve scripts and help with debugging.
The author has generously provided an extension that stubs out the proprietary extensions offered by Protonmail, so that sieve scripts written for their product can be tested.
I am trying to package this up so I can use it. I have a custom overlay package that I’ve built, and when I setup the dovecot2 service and install pigeonhole and this new package as modules, the two files from the extension show up where I would expect:
/run/current-system/sw/lib/dovecot/sieve/lib90_sieve_proton_compat_plugin.la
/run/current-system/sw/lib/dovecot/sieve/lib90_sieve_proton_compat_plugin.so
But when I use sieve-test, it expects to find it within its own nix store, so I get this:
Fatal: Plugin ‘sieve_proton_compat’ not found from directory /nix/store/ymrq5f9ql96b67kr8zl6ynar5ba4lz67-dovecot-pigeonhole-0.5.21.1/lib/dovecot/sieve
I’m guessing I might need to actually overlay the pigeonhole package and add in building this plugin as part of that package, but I’m guessing there’s probably a better way to this that I haven’t seen yet. Anyone have suggestions?
My overlay package:
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
dovecot,
dovecot_pigeonhole,
pkg-config,
}: let
pname = "pigeonhole-proton-compat-plugin";
dovecotMajorMinor = lib.versions.majorMinor dovecot.version;
in
stdenv.mkDerivation {
inherit pname;
version = "unstable-2025-02-10";
src = fetchFromGitHub {
owner = "stephanbosch";
repo = pname;
rev = "f064cc20f9231aadf261b7136726283a5a66efe9";
hash = "sha256-vM/rHVHIWq+DFSJ2FJ1wKF8h0atWMLFV3KaG5UXRZEg=";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
];
buildInputs = [
dovecot
dovecot_pigeonhole
];
configureFlags = [
"--with-dovecot=${dovecot}/lib/dovecot"
"--with-pigeonhole=${dovecot_pigeonhole}/include/dovecot-${dovecotMajorMinor}-pigeonhole/sieve/"
"--without-dovecot-install-dirs"
"--with-moduledir=$(out)/lib/dovecot"
];
meta = with lib; {
homepage = "https://pigeonhole.dovecot.org/";
description = "Pigeonhole plugin for testing Protonmail sieve scripts";
license = licenses.lgpl21Only;
platforms = platforms.unix;
};
}