diff --git a/flake.nix b/flake.nix index 2f21a87..2df1bf6 100644 --- a/flake.nix +++ b/flake.nix @@ -56,6 +56,7 @@ overlays/zfs-relmount overlays/ical2org.nix overlays/mautrix-discord.nix + overlays/maildrop ]; flake.nixosModules = { diff --git a/overlays/maildrop/default.nix b/overlays/maildrop/default.nix new file mode 100644 index 0000000..94baa5f --- /dev/null +++ b/overlays/maildrop/default.nix @@ -0,0 +1,49 @@ +{ lib, ... }: +let + inherit (lib) + singleton; + + pname = "maildrop"; + version = "3.1.5"; +in +{ + flake.overlays.maildrop = + final: prev: + { + maildrop = prev.stdenv.mkDerivation { + inherit pname version; + + src = prev.fetchurl { + url = "mirror://sourceforge/courier/${pname}/${version}/${pname}-${version}.tar.bz2"; + sha256 = "sha256-Izg/s5uSaQRWRpOXSO5zfnXJ8jmU+MBnI/MEyXp42lo="; + }; + + nativeBuildInputs = with prev; singleton pkg-config; + buildInputs = with prev; [ + perl + pcre2.dev + libidn2.dev + courier-unicode + ]; + + patches = [ + ./dont-reset-path.patch + ./maildrop.configure.hack.patch + ]; + + doCheck = false; + + configureFlags = [ + "--enable-maildrop-uid=" + "--enable-maildrop-gid=" + ]; + + meta = with lib; { + homepage = "http://www.courier-mta.org/maildrop/"; + description = "Mail filter/mail delivery agent that is used by the Courier Mail Server"; + license = licenses.gpl3; + platforms = platforms.linux; + }; + }; + }; +} diff --git a/overlays/maildrop/dont-reset-path.patch b/overlays/maildrop/dont-reset-path.patch new file mode 100644 index 0000000..b07f378 --- /dev/null +++ b/overlays/maildrop/dont-reset-path.patch @@ -0,0 +1,29 @@ +From 205aad195842ce19350261849d6378b39e00b11c Mon Sep 17 00:00:00 2001 +From: main +Date: Sun, 10 Apr 2022 15:35:10 +0200 +Subject: [PATCH] dont reset path + +--- + libs/maildrop/main.C | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libs/maildrop/main.C b/libs/maildrop/main.C +index efc7d1f..daf9d2d 100644 +--- a/libs/maildrop/main.C ++++ b/libs/maildrop/main.C +@@ -66,8 +66,8 @@ int quota_warn_percent = -1; + const char *quota_warn_message=0; + + static const char *defaults_vars[]={"LOCKEXT","LOCKSLEEP","LOCKTIMEOUT", +- "LOCKREFRESH", "PATH", "SENDMAIL", ++ "LOCKREFRESH", "SENDMAIL", + "MAILDIRQUOTA"}; + static const char *defaults_vals[]={LOCKEXT_DEF,LOCKSLEEP_DEF,LOCKTIMEOUT_DEF, +- LOCKREFRESH_DEF, DEFAULT_PATH, ++ LOCKREFRESH_DEF, + SENDMAIL_DEF, ""}; + + Maildrop maildrop; +-- +2.35.1 + diff --git a/overlays/maildrop/maildrop.configure.hack.patch b/overlays/maildrop/maildrop.configure.hack.patch new file mode 100644 index 0000000..130432a --- /dev/null +++ b/overlays/maildrop/maildrop.configure.hack.patch @@ -0,0 +1,13 @@ +--- a/libs/maildrop/configure 2012-09-06 01:52:13.000000000 +0100 ++++ b/libs/maildrop/configure 2013-01-04 03:00:57.095628327 +0000 +@@ -17562,8 +17562,8 @@ + check_spooldir() { + if test "$CHECKED_SPOOLDIR" != 1 + then +- get_spooldir +- MBOX_DIR="$SPOOLDIR" ++ MBOX_DIR="/var/spool/mail" ++ MBOX_RESET_GID=0 + CHECKED_SPOOLDIR=1 + fi + } \ No newline at end of file