uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,47 @@
{ lib, stdenv, fetchurl, openssl, perl, zlib, jam }:
stdenv.mkDerivation rec {
version = "3.2.0";
pname = "archiveopteryx";
src = fetchurl {
url = "http://archiveopteryx.org/download/${pname}-${version}.tar.bz2";
sha256 = "0i0zg8di8nbh96qnyyr156ikwcsq1w9b2291bazm5whb351flmqx";
};
nativeBuildInputs = [ jam ];
buildInputs = [ openssl perl zlib ];
preConfigure = ''
export INSTALLROOT=installroot
sed -i 's:BINDIR = $(PREFIX)/bin:BINDIR = '$out'/bin:' ./Jamsettings
sed -i 's:SBINDIR = $(PREFIX)/sbin:SBINDIR = '$out'/bin:' ./Jamsettings
sed -i 's:LIBDIR = $(PREFIX)/lib:LIBDIR = '$out'/lib:' ./Jamsettings
sed -i 's:MANDIR = $(PREFIX)/man:MANDIR = '$out'/share/man:' ./Jamsettings
sed -i 's:READMEDIR = $(PREFIX):READMEDIR = '$out'/share/doc/archiveopteryx:' ./Jamsettings
'';
# fix build on gcc7+ and gcc11+
NIX_CFLAGS_COMPILE = [
"-std=c++11" # c++17+ has errors
"-Wno-error=builtin-declaration-mismatch"
"-Wno-error=deprecated-copy"
"-Wno-error=implicit-fallthrough"
"-Wno-error=nonnull"
] ++ lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") [
"-Wno-error=mismatched-new-delete"
];
buildPhase = ''jam "-j$NIX_BUILD_CORES" '';
installPhase = ''
jam install
mv installroot/$out $out
'';
meta = with lib; {
homepage = "http://archiveopteryx.org/";
description = "An advanced PostgreSQL-based IMAP/POP server";
license = licenses.postgresql;
maintainers = [ maintainers.phunehehe ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,23 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation rec {
pname = "clamsmtp";
version = "1.10";
src = fetchurl {
url = "http://thewalter.net/stef/software/clamsmtp/${pname}-${version}.tar.gz";
sha256 = "0apr1pxifw6f1rbbsdrrwzs1dnhybg4hda3qqhqcw7p14r5xnbx5";
};
patches = [ ./header-order.patch ];
meta = with lib; {
description = "SMTP filter that allows to check for viruses using the ClamAV
anti-virus software";
homepage = "http://thewalter.net/stef/software/clamsmtp/";
license = licenses.bsd3;
maintainers = [ maintainers.ekleog ];
mainProgram = "clamsmtpd";
platforms = platforms.all;
};
}

View file

@ -0,0 +1,25 @@
diff --git a/common/smtppass.c b/common/smtppass.c
index d9be1ba..4a366f4 100644
--- a/common/smtppass.c
+++ b/common/smtppass.c
@@ -60,15 +60,15 @@
#include "usuals.h"
-#ifdef LINUX_TRANSPARENT_PROXY
-#include <linux/netfilter_ipv4.h>
-#endif
-
#include "compat.h"
#include "sock_any.h"
#include "stringx.h"
#include "sppriv.h"
+#ifdef LINUX_TRANSPARENT_PROXY
+#include <linux/netfilter_ipv4.h>
+#endif
+
/* -----------------------------------------------------------------------
* STRUCTURES
*/

View file

@ -0,0 +1,33 @@
{ lib, stdenv, perlPackages, fetchurl }:
stdenv.mkDerivation rec {
pname = "dkimproxy";
version = "1.4.1";
src = fetchurl {
url = "mirror://sourceforge/dkimproxy/${pname}-${version}.tar.gz";
sha256 = "1gc5c7lg2qrlck7b0lvjfqr824ch6jkrzkpsn0gjvlzg7hfmld75";
};
# Idea taken from pkgs/development/perl-modules/generic/builder.sh
preFixup = ''
perlFlags=
for i in $(IFS=:; echo $PERL5LIB); do
perlFlags="$perlFlags -I$i"
done
for f in $(ls $out/bin); do
sed -i $out/bin/$f -e "s|#\!\(.*/perl.*\)$|#\! \1 $perlFlags|"
done
'';
buildInputs = [ perlPackages.perl ];
propagatedBuildInputs = with perlPackages; [ Error MailDKIM MIMETools NetServer ];
meta = with lib; {
description = "SMTP-proxy that signs and/or verifies emails";
homepage = "http://dkimproxy.sourceforge.net/";
license = licenses.gpl2Plus;
maintainers = [ maintainers.ekleog ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,165 @@
diff -ru dovecot-2.3.9.2.orig/src/auth/main.c dovecot-2.3.9.2/src/auth/main.c
--- dovecot-2.3.9.2.orig/src/auth/main.c 2019-12-13 14:12:00.000000000 +0100
+++ dovecot-2.3.9.2/src/auth/main.c 2019-12-15 19:46:52.101597499 +0100
@@ -191,7 +191,7 @@
mod_set.debug = global_auth_settings->debug;
mod_set.filter_callback = auth_module_filter;
- modules = module_dir_load(AUTH_MODULE_DIR, NULL, &mod_set);
+ modules = module_dir_load("/etc/dovecot/modules/auth", NULL, &mod_set);
module_dir_init(modules);
if (!worker)
@@ -222,7 +222,7 @@
mod_set.debug = global_auth_settings->debug;
mod_set.ignore_missing = TRUE;
- modules = module_dir_load_missing(modules, AUTH_MODULE_DIR, names,
+ modules = module_dir_load_missing(modules, "/etc/dovecot/modules/auth", names,
&mod_set);
module_dir_init(modules);
}
diff -ru dovecot-2.3.9.2.orig/src/config/all-settings.c dovecot-2.3.9.2/src/config/all-settings.c
--- dovecot-2.3.9.2.orig/src/config/all-settings.c 2019-12-13 14:12:32.000000000 +0100
+++ dovecot-2.3.9.2/src/config/all-settings.c 2019-12-15 19:49:42.764650074 +0100
@@ -1080,7 +1080,7 @@
.last_valid_gid = 0,
.mail_plugins = "",
- .mail_plugin_dir = MODULEDIR,
+ .mail_plugin_dir = "/etc/dovecot/modules",
.mail_log_prefix = "%s(%u)<%{pid}><%{session}>: ",
@@ -3849,7 +3849,7 @@
.login_log_format = "%$: %s",
.login_access_sockets = "",
.login_proxy_notify_path = "proxy-notify",
- .login_plugin_dir = MODULEDIR"/login",
+ .login_plugin_dir = "/etc/dovecot/modules""/login",
.login_plugins = "",
.login_proxy_max_disconnect_delay = 0,
.director_username_hash = "%u",
@@ -4058,7 +4058,7 @@
.login_trusted_networks = "",
.mail_plugins = "",
- .mail_plugin_dir = MODULEDIR,
+ .mail_plugin_dir = "/etc/dovecot/modules",
};
static const struct setting_parser_info *lmtp_setting_dependencies[] = {
&lda_setting_parser_info,
@@ -4823,7 +4823,7 @@
.base_dir = PKG_RUNDIR,
.libexec_dir = PKG_LIBEXECDIR,
.mail_plugins = "",
- .mail_plugin_dir = MODULEDIR,
+ .mail_plugin_dir = "/etc/dovecot/modules",
.mail_temp_dir = "/tmp",
.auth_debug = FALSE,
.auth_socket_path = "auth-userdb",
diff -ru dovecot-2.3.9.2.orig/src/config/config-parser.c dovecot-2.3.9.2/src/config/config-parser.c
--- dovecot-2.3.9.2.orig/src/config/config-parser.c 2019-12-13 14:12:00.000000000 +0100
+++ dovecot-2.3.9.2/src/config/config-parser.c 2019-12-15 19:46:52.102597505 +0100
@@ -1077,7 +1077,7 @@
i_zero(&mod_set);
mod_set.abi_version = DOVECOT_ABI_VERSION;
- modules = module_dir_load(CONFIG_MODULE_DIR, NULL, &mod_set);
+ modules = module_dir_load("/etc/dovecot/modules/settings", NULL, &mod_set);
module_dir_init(modules);
i_array_init(&new_roots, 64);
diff -ru dovecot-2.3.9.2.orig/src/dict/main.c dovecot-2.3.9.2/src/dict/main.c
--- dovecot-2.3.9.2.orig/src/dict/main.c 2019-12-13 14:12:00.000000000 +0100
+++ dovecot-2.3.9.2/src/dict/main.c 2019-12-15 19:46:52.102597505 +0100
@@ -104,7 +104,7 @@
mod_set.abi_version = DOVECOT_ABI_VERSION;
mod_set.require_init_funcs = TRUE;
- modules = module_dir_load(DICT_MODULE_DIR, NULL, &mod_set);
+ modules = module_dir_load("/etc/dovecot/modules/dict", NULL, &mod_set);
module_dir_init(modules);
/* Register only after loading modules. They may contain SQL drivers,
diff -ru dovecot-2.3.9.2.orig/src/doveadm/doveadm-settings.c dovecot-2.3.9.2/src/doveadm/doveadm-settings.c
--- dovecot-2.3.9.2.orig/src/doveadm/doveadm-settings.c 2019-12-13 14:12:00.000000000 +0100
+++ dovecot-2.3.9.2/src/doveadm/doveadm-settings.c 2019-12-15 19:47:29.525812499 +0100
@@ -89,7 +89,7 @@
.base_dir = PKG_RUNDIR,
.libexec_dir = PKG_LIBEXECDIR,
.mail_plugins = "",
- .mail_plugin_dir = MODULEDIR,
+ .mail_plugin_dir = "/etc/dovecot/modules",
.mail_temp_dir = "/tmp",
.auth_debug = FALSE,
.auth_socket_path = "auth-userdb",
diff -ru dovecot-2.3.9.2.orig/src/doveadm/doveadm-util.c dovecot-2.3.9.2/src/doveadm/doveadm-util.c
--- dovecot-2.3.9.2.orig/src/doveadm/doveadm-util.c 2019-12-13 14:12:00.000000000 +0100
+++ dovecot-2.3.9.2/src/doveadm/doveadm-util.c 2019-12-15 19:52:32.003844670 +0100
@@ -33,7 +33,7 @@
mod_set.debug = doveadm_debug;
mod_set.ignore_dlopen_errors = TRUE;
- modules = module_dir_load_missing(modules, DOVEADM_MODULEDIR,
+ modules = module_dir_load_missing(modules, "/etc/dovecot/modules/doveadm",
NULL, &mod_set);
module_dir_init(modules);
}
@@ -58,7 +58,7 @@
return FALSE;
}
- dir = opendir(DOVEADM_MODULEDIR);
+ dir = opendir("/etc/dovecot/modules/doveadm");
if (dir == NULL)
return FALSE;
diff -ru dovecot-2.3.9.2.orig/src/lib-fs/fs-api.c dovecot-2.3.9.2/src/lib-fs/fs-api.c
--- dovecot-2.3.9.2.orig/src/lib-fs/fs-api.c 2019-12-13 14:12:00.000000000 +0100
+++ dovecot-2.3.9.2/src/lib-fs/fs-api.c 2019-12-15 19:46:52.102597505 +0100
@@ -114,7 +114,7 @@
mod_set.abi_version = DOVECOT_ABI_VERSION;
mod_set.ignore_missing = TRUE;
- fs_modules = module_dir_load_missing(fs_modules, MODULE_DIR,
+ fs_modules = module_dir_load_missing(fs_modules, "/etc/dovecot/modules",
module_name, &mod_set);
module_dir_init(fs_modules);
diff -ru dovecot-2.3.9.2.orig/src/lib-ssl-iostream/iostream-ssl.c dovecot-2.3.9.2/src/lib-ssl-iostream/iostream-ssl.c
--- dovecot-2.3.9.2.orig/src/lib-ssl-iostream/iostream-ssl.c 2019-12-13 14:12:00.000000000 +0100
+++ dovecot-2.3.9.2/src/lib-ssl-iostream/iostream-ssl.c 2019-12-15 19:46:52.102597505 +0100
@@ -54,7 +54,7 @@
mod_set.abi_version = DOVECOT_ABI_VERSION;
mod_set.setting_name = "<built-in lib-ssl-iostream lookup>";
mod_set.require_init_funcs = TRUE;
- ssl_module = module_dir_load(MODULE_DIR, plugin_name, &mod_set);
+ ssl_module = module_dir_load("/etc/dovecot/modules", plugin_name, &mod_set);
if (module_dir_try_load_missing(&ssl_module, MODULE_DIR, plugin_name,
&mod_set, error_r) < 0)
return -1;
diff -ru dovecot-2.3.9.2.orig/src/lib-storage/mail-storage-settings.c dovecot-2.3.9.2/src/lib-storage/mail-storage-settings.c
--- dovecot-2.3.9.2.orig/src/lib-storage/mail-storage-settings.c 2019-12-13 14:12:00.000000000 +0100
+++ dovecot-2.3.9.2/src/lib-storage/mail-storage-settings.c 2019-12-15 19:46:52.102597505 +0100
@@ -337,7 +337,7 @@
.last_valid_gid = 0,
.mail_plugins = "",
- .mail_plugin_dir = MODULEDIR,
+ .mail_plugin_dir = "/etc/dovecot/modules",
.mail_log_prefix = "%s(%u)<%{pid}><%{session}>: ",
diff -ru dovecot-2.3.9.2.orig/src/lmtp/lmtp-settings.c dovecot-2.3.9.2/src/lmtp/lmtp-settings.c
--- dovecot-2.3.9.2.orig/src/lmtp/lmtp-settings.c 2019-12-13 14:12:00.000000000 +0100
+++ dovecot-2.3.9.2/src/lmtp/lmtp-settings.c 2019-12-15 19:46:52.102597505 +0100
@@ -95,7 +95,7 @@
.login_trusted_networks = "",
.mail_plugins = "",
- .mail_plugin_dir = MODULEDIR,
+ .mail_plugin_dir = "/etc/dovecot/modules",
};
static const struct setting_parser_info *lmtp_setting_dependencies[] = {

View file

@ -0,0 +1,111 @@
{ stdenv, lib, fetchurl, perl, pkg-config, systemd, openssl
, bzip2, zlib, lz4, inotify-tools, pam, libcap, coreutils
, clucene_core_2, icu, openldap, libsodium, libstemmer, cyrus_sasl
, nixosTests
# Auth modules
, withMySQL ? false, libmysqlclient
, withPgSQL ? false, postgresql
, withSQLite ? true, sqlite
, withLua ? false, lua5_3
}:
stdenv.mkDerivation rec {
pname = "dovecot";
version = "2.3.19";
nativeBuildInputs = [ perl pkg-config ];
buildInputs =
[ openssl bzip2 zlib lz4 clucene_core_2 icu openldap libsodium libstemmer cyrus_sasl.dev ]
++ lib.optionals (stdenv.isLinux) [ systemd pam libcap inotify-tools ]
++ lib.optional withMySQL libmysqlclient
++ lib.optional withPgSQL postgresql
++ lib.optional withSQLite sqlite
++ lib.optional withLua lua5_3;
src = fetchurl {
url = "https://dovecot.org/releases/${lib.versions.majorMinor version}/${pname}-${version}.tar.gz";
hash = "sha256:0ys3zq9b1rgj1cz6a0i9l421y6h2j3b5zak2ia5j9dj1sj9zcwq1";
};
enableParallelBuilding = true;
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
'';
# We need this for sysconfdir, see remark below.
installFlags = [ "DESTDIR=$(out)" ];
postInstall = ''
cp -r $out/$out/* $out
rm -rf $out/$(echo "$out" | cut -d "/" -f2)
'';
patches = [
# Make dovecot look for plugins in /etc/dovecot/modules
# so we can symlink plugins from several packages there.
# The symlinking needs to be done in NixOS.
./2.3.x-module_dir.patch
];
configureFlags = [
# It will hardcode this for /var/lib/dovecot.
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626211
"--localstatedir=/var"
# We need this so utilities default to reading /etc/dovecot/dovecot.conf file.
"--sysconfdir=/etc"
"--with-ldap"
"--with-ssl=openssl"
"--with-zlib"
"--with-bzlib"
"--with-lz4"
"--with-ldap"
"--with-lucene"
"--with-icu"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"i_cv_epoll_works=${if stdenv.isLinux then "yes" else "no"}"
"i_cv_posix_fallocate_works=${if stdenv.isDarwin then "no" else "yes"}"
"i_cv_inotify_works=${if stdenv.isLinux then "yes" else "no"}"
"i_cv_signed_size_t=no"
"i_cv_signed_time_t=yes"
"i_cv_c99_vsnprintf=yes"
"lib_cv_va_copy=yes"
"i_cv_mmap_plays_with_write=yes"
"i_cv_gmtime_max_time_t=${toString stdenv.hostPlatform.parsed.cpu.bits}"
"i_cv_signed_time_t=yes"
"i_cv_fd_passing=yes"
"lib_cv_va_copy=yes"
"lib_cv___va_copy=yes"
"lib_cv_va_val_copy=yes"
] ++ lib.optional stdenv.isLinux "--with-systemd"
++ lib.optional stdenv.isDarwin "--enable-static"
++ lib.optional withMySQL "--with-mysql"
++ lib.optional withPgSQL "--with-pgsql"
++ lib.optional withSQLite "--with-sqlite"
++ lib.optional withLua "--with-lua";
doCheck = !stdenv.isDarwin;
meta = with lib; {
homepage = "https://dovecot.org/";
description = "Open source IMAP and POP3 email server written with security primarily in mind";
license = with licenses; [ mit publicDomain lgpl21Only bsd3 bsdOriginal ];
maintainers = with maintainers; [ fpletz globin ajs124 ];
platforms = platforms.unix;
};
passthru.tests = {
opensmtpd-interaction = nixosTests.opensmtpd;
inherit (nixosTests) dovecot;
};
}

View file

@ -0,0 +1,36 @@
{ lib, stdenv, fetchFromGitHub, autoconf, automake, sqlite, pkg-config, dovecot, libtool, xapian, icu64 }:
stdenv.mkDerivation rec {
pname = "dovecot-fts-xapian";
version = "1.5.5";
src = fetchFromGitHub {
owner = "grosjo";
repo = "fts-xapian";
rev = version;
sha256 = "sha256-KAZno4N/4dFH3QHFTs0wkY4PtGF+j4ZEjZzn9ljCjrM=";
};
buildInputs = [ dovecot xapian icu64 sqlite ];
nativeBuildInputs = [ autoconf automake libtool pkg-config ];
preConfigure = ''
export PANDOC=false
autoreconf -vi
'';
configureFlags = [
"--with-dovecot=${dovecot}/lib/dovecot"
"--with-moduledir=$(out)/lib/dovecot"
];
meta = with lib; {
homepage = "https://github.com/grosjo/fts-xapian";
description = "Dovecot FTS plugin based on Xapian";
changelog = "https://github.com/grosjo/fts-xapian/releases";
license = licenses.lgpl21Only;
maintainers = with maintainers; [ julm symphorien ];
platforms = platforms.unix;
broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/dovecot_fts_xapian.x86_64-darwin
};
}

View file

@ -0,0 +1,39 @@
{ lib, stdenv, fetchurl, dovecot, openssl }:
let
dovecotMajorMinor = lib.versions.majorMinor dovecot.version;
in stdenv.mkDerivation rec {
pname = "dovecot-pigeonhole";
version = "0.5.19";
src = fetchurl {
url = "https://pigeonhole.dovecot.org/releases/${dovecotMajorMinor}/dovecot-${dovecotMajorMinor}-pigeonhole-${version}.tar.gz";
hash = "sha256:033kkhby9k9yrmgvlfmyzp8fccsw5bhq1dyvxj94sg3grkpj7f8h";
};
buildInputs = [ dovecot openssl ];
preConfigure = ''
substituteInPlace src/managesieve/managesieve-settings.c --replace \
".executable = \"managesieve\"" \
".executable = \"$out/libexec/dovecot/managesieve\""
substituteInPlace src/managesieve-login/managesieve-login-settings.c --replace \
".executable = \"managesieve-login\"" \
".executable = \"$out/libexec/dovecot/managesieve-login\""
'';
configureFlags = [
"--with-dovecot=${dovecot}/lib/dovecot"
"--without-dovecot-install-dirs"
"--with-moduledir=$(out)/lib/dovecot"
];
enableParallelBuilding = true;
meta = with lib; {
homepage = "https://pigeonhole.dovecot.org/";
description = "A sieve plugin for the Dovecot IMAP server";
license = licenses.lgpl21Only;
maintainers = with maintainers; [ globin ajs124 ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,115 @@
{ stdenv, lib, fetchurl, makeWrapper
, gawk, gnused, gnugrep, coreutils, which
, perlPackages
, withMySQL ? false, zlib, mysql57
, withPgSQL ? false, postgresql
, withSQLite ? false, sqlite
, withDB ? false, db
}:
let
drivers = lib.concatStringsSep ","
([ "hash_drv" ]
++ lib.optional withMySQL "mysql_drv"
++ lib.optional withPgSQL "pgsql_drv"
++ lib.optional withSQLite "sqlite3_drv"
++ lib.optional withDB "libdb4_drv"
);
maintenancePath = lib.makeBinPath [ gawk gnused gnugrep coreutils which ];
in stdenv.mkDerivation rec {
pname = "dspam";
version = "3.10.2";
src = fetchurl {
url = "mirror://sourceforge/dspam/dspam/${pname}-${version}/${pname}-${version}.tar.gz";
sha256 = "1acklnxn1wvc7abn31l3qdj8q6k13s51k5gv86vka7q20jb5cxmf";
};
buildInputs = [ perlPackages.perl ]
++ lib.optionals withMySQL [ zlib mysql57.connector-c ]
++ lib.optional withPgSQL postgresql
++ lib.optional withSQLite sqlite
++ lib.optional withDB db;
nativeBuildInputs = [ makeWrapper ];
configureFlags = [
"--with-storage-driver=${drivers}"
"--sysconfdir=/etc/dspam"
"--localstatedir=/var"
"--with-dspam-home=/var/lib/dspam"
"--with-logdir=/var/log/dspam"
"--with-logfile=/var/log/dspam/dspam.log"
"--enable-daemon"
"--enable-clamav"
"--enable-syslog"
"--enable-large-scale"
"--enable-virtual-users"
"--enable-split-configuration"
"--enable-preferences-extension"
"--enable-long-usernames"
"--enable-external-lookup"
] ++ lib.optional withMySQL "--with-mysql-includes=${mysql57.connector-c}/include/mysql"
++ lib.optional withPgSQL "--with-pgsql-libraries=${postgresql.lib}/lib";
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: .libs/hash_drv.o:/build/dspam-3.10.2/src/util.h:96: multiple definition of `verified_user';
# .libs/libdspam.o:/build/dspam-3.10.2/src/util.h:96: first defined here
NIX_CFLAGS_COMPILE = "-fcommon";
# Lots of things are hardwired to paths like sysconfdir. That's why we install with both "prefix" and "DESTDIR"
# and fix directory structure manually after that.
installFlags = [ "DESTDIR=$(out)" ];
postInstall = ''
cp -r $out/$out/* $out
rm -rf $out/$(echo "$out" | cut -d "/" -f2)
rm -rf $out/var
wrapProgram $out/bin/dspam_notify \
--set PERL5LIB "${perlPackages.makePerlPath [ perlPackages.libnet ]}"
# Install SQL scripts
mkdir -p $out/share/dspam/sql
# MySQL
cp src/tools.mysql_drv/mysql_*.sql $out/share/dspam/sql
for i in src/tools.mysql_drv/{purge*.sql,virtual*.sql}; do
cp "$i" $out/share/dspam/sql/mysql_$(basename "$i")
done
# PostgreSQL
cp src/tools.pgsql_drv/pgsql_*.sql $out/share/dspam/sql
for i in src/tools.pgsql_drv/{purge*.sql,virtual*.sql}; do
cp "$i" $out/share/dspam/sql/pgsql_$(basename "$i")
done
# SQLite
for i in src/tools.sqlite_drv/purge*.sql; do
cp "$i" $out/share/dspam/sql/sqlite_$(basename "$i")
done
# Install maintenance script
install -Dm755 contrib/dspam_maintenance/dspam_maintenance.sh $out/bin/dspam_maintenance
sed -i \
-e "2iexport PATH=$out/bin:${maintenancePath}:\$PATH" \
-e 's,/usr/[a-z0-9/]*,,g' \
-e 's,^DSPAM_CONFIGDIR=.*,DSPAM_CONFIGDIR=/etc/dspam,' \
-e "s,^DSPAM_HOMEDIR=.*,DSPAM_HOMEDIR=/var/lib/dspam," \
-e "s,^DSPAM_PURGE_SCRIPT_DIR=.*,DSPAM_PURGE_SCRIPT_DIR=$out/share/dspam/sql," \
-e "s,^DSPAM_BIN_DIR=.*,DSPAM_BIN_DIR=$out/bin," \
-e "s,^MYSQL_BIN_DIR=.*,MYSQL_BIN_DIR=/run/current-system/sw/bin," \
-e "s,^PGSQL_BIN_DIR=.*,PGSQL_BIN_DIR=/run/current-system/sw/bin," \
-e "s,^SQLITE_BIN_DIR=.*,SQLITE_BIN_DIR=/run/current-system/sw/bin," \
-e "s,^SQLITE3_BIN_DIR=.*,SQLITE3_BIN_DIR=/run/current-system/sw/bin," \
-e 's,^DSPAM_CRON_LOCKFILE=.*,DSPAM_CRON_LOCKFILE=/run/dspam/dspam_maintenance.pid,' \
$out/bin/dspam_maintenance
'';
meta = with lib; {
homepage = "http://dspam.sourceforge.net/";
description = "Community Driven Antispam Filter";
license = licenses.agpl3Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ abbradar ];
};
}

View file

@ -0,0 +1,119 @@
{ coreutils, db, fetchurl, openssl, pcre, perl, pkg-config, lib, stdenv
, enableLDAP ? false, openldap
, enableMySQL ? false, libmysqlclient, zlib
, enableAuthDovecot ? false, dovecot
, enablePAM ? false, pam
, enableSPF ? true, libspf2
, enableDMARC ? true, opendmarc
, enableRedis ? false, hiredis
}:
stdenv.mkDerivation rec {
pname = "exim";
version = "4.95";
src = fetchurl {
url = "https://ftp.exim.org/pub/exim/exim4/${pname}-${version}.tar.xz";
sha256 = "0rzi0kc3qiiaw8vnv5qrpwdvvh4sr5chns026xy99spjzx9vd76c";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ coreutils db openssl perl pcre ]
++ lib.optional enableLDAP openldap
++ lib.optionals enableMySQL [ libmysqlclient zlib ]
++ lib.optional enableAuthDovecot dovecot
++ lib.optional enablePAM pam
++ lib.optional enableSPF libspf2
++ lib.optional enableDMARC opendmarc
++ lib.optional enableRedis hiredis;
preBuild = ''
sed '
s:^\(BIN_DIRECTORY\)=.*:\1='"$out"'/bin:
s:^\(CONFIGURE_FILE\)=.*:\1=/etc/exim.conf:
s:^\(EXIM_USER\)=.*:\1=ref\:nobody:
s:^\(SPOOL_DIRECTORY\)=.*:\1=/exim-homeless-shelter:
s:^# \(TRANSPORT_LMTP\)=.*:\1=yes:
s:^# \(SUPPORT_MAILDIR\)=.*:\1=yes:
s:^EXIM_MONITOR=.*$:# &:
s:^\(FIXED_NEVER_USERS\)=root$:\1=0:
s:^# \(WITH_CONTENT_SCAN\)=.*:\1=yes:
s:^# \(AUTH_PLAINTEXT\)=.*:\1=yes:
s:^# \(USE_OPENSSL\)=.*:\1=yes:
s:^# \(USE_OPENSSL_PC=openssl\)$:\1:
s:^# \(LOG_FILE_PATH=syslog\)$:\1:
s:^# \(HAVE_IPV6=yes\)$:\1:
s:^# \(CHOWN_COMMAND\)=.*:\1=${coreutils}/bin/chown:
s:^# \(CHGRP_COMMAND\)=.*:\1=${coreutils}/bin/chgrp:
s:^# \(CHMOD_COMMAND\)=.*:\1=${coreutils}/bin/chmod:
s:^# \(MV_COMMAND\)=.*:\1=${coreutils}/bin/mv:
s:^# \(RM_COMMAND\)=.*:\1=${coreutils}/bin/rm:
s:^# \(TOUCH_COMMAND\)=.*:\1=${coreutils}/bin/touch:
s:^# \(PERL_COMMAND\)=.*:\1=${perl}/bin/perl:
s:^# \(LOOKUP_DSEARCH=yes\)$:\1:
${lib.optionalString enableLDAP ''
s:^# \(LDAP_LIB_TYPE=OPENLDAP2\)$:\1:
s:^# \(LOOKUP_LDAP=yes\)$:\1:
s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lldap -llber:
s:^# \(LOOKUP_LIBS\)=.*:\1=-lldap -llber:
''}
${lib.optionalString enableMySQL ''
s:^# \(LOOKUP_MYSQL=yes\)$:\1:
s:^# \(LOOKUP_MYSQL_PC=libmysqlclient\)$:\1:
s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -ldl -lm -lpthread -lz:
s:^# \(LOOKUP_LIBS\)=.*:\1=-lmysqlclient -L${libmysqlclient}/lib/mysql -lssl -ldl -lm -lpthread -lz:
s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${libmysqlclient.dev}/include/mysql/:
''}
${lib.optionalString enableAuthDovecot ''
s:^# \(AUTH_DOVECOT\)=.*:\1=yes:
''}
${lib.optionalString enablePAM ''
s:^# \(SUPPORT_PAM\)=.*:\1=yes:
s:^\(EXTRALIBS_EXIM\)=\(.*\):\1=\2 -lpam:
s:^# \(EXTRALIBS_EXIM\)=.*:\1=-lpam:
''}
${lib.optionalString enableSPF ''
s:^# \(SUPPORT_SPF\)=.*:\1=yes:
s:^# \(LDFLAGS += -lspf2\):\1:
''}
${lib.optionalString enableDMARC ''
s:^# \(SUPPORT_DMARC\)=.*:\1=yes:
s:^# \(LDFLAGS += -lopendmarc\):\1:
''}
${lib.optionalString enableRedis ''
s:^# \(LOOKUP_REDIS=yes\)$:\1:
s:^\(LOOKUP_LIBS\)=\(.*\):\1=\2 -lhiredis -L${hiredis}/lib/hiredis:
s:^# \(LOOKUP_LIBS\)=.*:\1=-lhiredis -L${hiredis}/lib/hiredis:
s:^\(LOOKUP_INCLUDE\)=\(.*\):\1=\2 -I${hiredis}/include/hiredis/:
s:^# \(LOOKUP_INCLUDE\)=.*:\1=-I${hiredis}/include/hiredis/:
''}
#/^\s*#.*/d
#/^\s*$/d
' < src/EDITME > Local/Makefile
'';
installPhase = ''
mkdir -p $out/bin $out/share/man/man8
cp doc/exim.8 $out/share/man/man8
( cd build-Linux-*
cp exicyclog exim_checkaccess exim_dumpdb exim_lock exim_tidydb \
exipick exiqsumm exigrep exim_dbmbuild exim exim_fixdb eximstats \
exinext exiqgrep exiwhat \
$out/bin )
( cd $out/bin
for i in mailq newaliases rmail rsmtp runq sendmail; do
ln -s exim $i
done )
'';
meta = with lib; {
homepage = "https://exim.org/";
description = "A mail transfer agent (MTA)";
license = with licenses; [ gpl2Plus bsd3 ];
platforms = platforms.linux;
maintainers = with maintainers; [ tv ajs124 das_j ];
changelog = "https://github.com/Exim/exim/blob/exim-${version}/doc/doc-txt/ChangeLog";
};
}

View file

@ -0,0 +1,25 @@
{ lib, buildGoPackage, fetchFromGitHub }:
buildGoPackage rec {
pname = "MailHog";
version = "1.0.1";
goPackagePath = "github.com/mailhog/MailHog";
src = fetchFromGitHub {
owner = "mailhog";
repo = "MailHog";
rev = "v${version}";
sha256 = "124216850572r1h0ii7ad6jd1cd5czcvkz7k2jzvjb4pv2kl8p3y";
};
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
meta = with lib; {
description = "Web and API based SMTP testing";
homepage = "https://github.com/mailhog/MailHog";
changelog = "https://github.com/mailhog/MailHog/releases/tag/v${version}";
maintainers = with maintainers; [ disassembler jojosch ];
license = licenses.mit;
};
}

View file

@ -0,0 +1,33 @@
{ newScope, lib, python3 }:
let
callPackage = newScope self;
self = lib.makeExtensible (self: {
python3 = callPackage ./python.nix { inherit python3; };
hyperkitty = callPackage ./hyperkitty.nix { };
mailman = callPackage ./package.nix { };
mailman-hyperkitty = callPackage ./mailman-hyperkitty.nix { };
postorius = callPackage ./postorius.nix { };
web = callPackage ./web.nix { };
buildEnvs = { web ? self.web
, mailman ? self.mailman
, mailman-hyperkitty ? self.mailman-hyperkitty
, withHyperkitty ? false
}:
{
mailmanEnv = self.python3.withPackages
(ps: [ mailman ps.psycopg2 ]
++ lib.optional withHyperkitty mailman-hyperkitty);
webEnv = self.python3.withPackages
(ps: [ web ps.psycopg2 ]);
};
});
in self

View file

@ -0,0 +1,78 @@
{ lib
, python3
, fetchpatch
}:
with python3.pkgs;
buildPythonPackage rec {
pname = "HyperKitty";
# Note: Mailman core must be on the latest version before upgrading HyperKitty.
# See: https://gitlab.com/mailman/postorius/-/issues/516#note_544571309
version = "1.3.5";
disabled = pythonOlder "3.8";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-gmkiK8pIHfubbbxNdm/D6L2o722FptxYgINYdIUOn4Y=";
};
patches = [
# FIXME: backport Python 3.10 support fix, remove for next release
(fetchpatch {
url = "https://gitlab.com/mailman/hyperkitty/-/commit/551a44a76e46931fc5c1bcb341235d8f579820be.patch";
sha256 = "sha256-5XCrvyrDEqH3JryPMoOXSlVVDLQ+PdYBqwGYxkExdvk=";
includes = [ "hyperkitty/*" ];
})
];
postPatch = ''
# isort is a development dependency
sed -i '/isort/d' setup.py
# Fix mistune imports for mistune >= 2.0.0
# https://gitlab.com/mailman/hyperkitty/-/merge_requests/379
sed -i 's/mistune.scanner/mistune.util/' hyperkitty/lib/renderer.py
'';
propagatedBuildInputs = [
django
django-gravatar2
django-haystack
django-mailman3
django-q
django_compressor
django-extensions
djangorestframework
flufl_lock
mistune_2_0
networkx
psycopg2
python-dateutil
robot-detection
];
# Some of these are optional runtime dependencies that are not
# listed as dependencies in setup.py. To use these, they should be
# dependencies of the Django Python environment, but not of
# HyperKitty so they're not included for people who don't need them.
checkInputs = [
beautifulsoup4
elasticsearch
mock
whoosh
];
checkPhase = ''
cd $NIX_BUILD_TOP/$sourceRoot
PYTHONPATH=.:$PYTHONPATH python example_project/manage.py test \
--settings=hyperkitty.tests.settings_test hyperkitty
'';
meta = {
homepage = "https://www.gnu.org/software/mailman/";
description = "Archiver for GNU Mailman v3";
license = lib.licenses.gpl3;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ globin qyliss ];
};
}

View file

@ -0,0 +1,13 @@
diff --git a/src/mailman/core/logging.py b/src/mailman/core/logging.py
index f8f87279f..7ff13b003 100644
--- a/src/mailman/core/logging.py
+++ b/src/mailman/core/logging.py
@@ -142,6 +142,8 @@ def _init_logger(propagate, sub_name, log, logger_config):
address, facility = _get_syslog_params(logger_config)
handler = logging.handlers.SysLogHandler(
address=address, facility=facility)
+ elif logger_config.handler == 'stderr':
+ handler = logging.StreamHandler(sys.stderr)
else:
path_str = logger_config.path
path_abs = os.path.normpath(os.path.join(config.LOG_DIR, path_str))

View file

@ -0,0 +1,47 @@
{ lib
, python3
, mailman
}:
with python3.pkgs;
buildPythonPackage rec {
pname = "mailman-hyperkitty";
version = "1.2.0";
format = "setuptools";
disabled = pythonOlder "3.9";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-EQBx1KX3z/Wv3QAHOi+s/ihLOjpiupIQBYyE6IPbJto=";
};
propagatedBuildInputs = [
mailman
requests
zope_interface
];
checkInputs = [
mock
nose2
];
checkPhase = ''
${python.interpreter} -m nose2 -v
'';
# There is an AssertionError
doCheck = false;
pythonImportsCheck = [
"mailman_hyperkitty"
];
meta = with lib; {
description = "Mailman archiver plugin for HyperKitty";
homepage = "https://gitlab.com/mailman/mailman-hyperkitty";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ globin qyliss ];
};
}

View file

@ -0,0 +1,76 @@
{ lib, fetchpatch, python3, postfix, lynx
}:
with python3.pkgs;
buildPythonPackage rec {
pname = "mailman";
version = "3.3.5";
disabled = pythonOlder "3.6";
src = fetchPypi {
inherit pname version;
sha256 = "12mgxs1ndhdjjkydx48b95na9k9h0disfqgrr6wxx7vda6dqvcwz";
};
propagatedBuildInputs = with python3.pkgs; [
aiosmtpd
alembic
authheaders
click
dnspython
falcon
flufl_bounce
flufl_i18n
flufl_lock
gunicorn
importlib-resources
lazr_config
passlib
requests
sqlalchemy
zope_component
zope_configuration
];
patches = [
(fetchpatch {
url = "https://gitlab.com/mailman/mailman/-/commit/4b206e2a5267a0e17f345fd7b2d957122ba57566.patch";
sha256 = "06axmrn74p81wvcki36c7gfj5fp5q15zxz2yl3lrvijic7hbs4n2";
})
(fetchpatch {
url = "https://gitlab.com/mailman/mailman/-/commit/9613154f3c04fa2383fbf017031ef263c291418d.patch";
sha256 = "0vyw87s857vfxbf7kihwb6w094xyxmxbi1bpdqi3ybjamjycp55r";
})
./log-stderr.patch
];
postPatch = ''
substituteInPlace setup.py \
--replace "alembic>=1.6.2,<1.7" "alembic>=1.6.2"
substituteInPlace src/mailman/config/postfix.cfg \
--replace /usr/sbin/postmap ${postfix}/bin/postmap
substituteInPlace src/mailman/config/schema.cfg \
--replace /usr/bin/lynx ${lynx}/bin/lynx
'';
# Mailman assumes that those scripts in $out/bin are Python scripts. Wrapping
# them in shell code breaks this assumption. Use the wrapped version (see
# wrapped.nix) if you need the CLI (rather than the Python library).
#
# This gives a properly wrapped 'mailman' command plus an interpreter that
# has all the necessary search paths to execute unwrapped 'master' and
# 'runner' scripts.
dontWrapPythonPrograms = true;
# requires flufl.testing, which the upstream has archived
doCheck = false;
meta = {
homepage = "https://www.gnu.org/software/mailman/";
description = "Free software for managing electronic mail discussion and newsletter lists";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ qyliss ma27 ];
};
}

View file

@ -0,0 +1,28 @@
{ lib, python3 }:
with python3.pkgs;
buildPythonPackage rec {
pname = "postorius";
# Note: Mailman core must be on the latest version before upgrading Postorious.
# See: https://gitlab.com/mailman/postorius/-/issues/516#note_544571309
version = "1.3.6";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-KwzEU9IfcQ6YPZu3jPuFrd6ux/3e2pzoLfTrak/aGmg=";
};
propagatedBuildInputs = [ django-mailman3 readme_renderer ];
checkInputs = [ beautifulsoup4 vcrpy mock ];
# Tries to connect to database.
doCheck = false;
meta = with lib; {
homepage = "https://docs.mailman3.org/projects/postorius";
description = "Web-based user interface for managing GNU Mailman";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ globin qyliss ];
};
}

View file

@ -0,0 +1,30 @@
{ python3 }:
python3.override {
packageOverrides = self: super: {
# does not find tests
alembic = super.alembic.overridePythonAttrs (oldAttrs: {
doCheck = false;
});
# Needed by mailman, see https://gitlab.com/mailman/mailman/-/issues/964
sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec {
version = "1.3.24";
src = super.fetchPypi {
inherit version;
inherit (oldAttrs) pname;
sha256 = "06bmxzssc66cblk1hamskyv5q3xf1nh1py3vi6dka4lkpxy7gfzb";
};
# does not find tests
doCheck = false;
});
# Fixes `AssertionError: database connection isn't set to UTC`
psycopg2 = super.psycopg2.overridePythonAttrs (a: (rec {
version = "2.8.6";
src = super.fetchPypi {
inherit version;
inherit (a) pname;
sha256 = "fb23f6c71107c37fd667cb4ea363ddeb936b348bbd6449278eb92c189699f543";
};
}));
};
}

View file

@ -0,0 +1,46 @@
{ lib, python3
, sassc, hyperkitty, postorius
}:
with python3.pkgs;
buildPythonPackage rec {
pname = "mailman-web";
version = "0.0.5";
disabled = pythonOlder "3.8";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-9pvs/VATAsMcGNrj58b/LifysEPTNhrAP57sfp4nX6Q=";
};
postPatch = ''
# Django is depended on transitively by hyperkitty and postorius,
# and mailman_web has overly restrictive version bounds on it, so
# let's remove it.
sed -i '/^[[:space:]]*django/Id' setup.cfg
# Upstream seems to mostly target installing on top of existing
# distributions, and uses a path appropriate for that, but we are
# a distribution, so use a state directory appropriate for a
# distro package.
substituteInPlace mailman_web/settings/base.py \
--replace /opt/mailman/web /var/lib/mailman-web
'';
nativeBuildInputs = [ setuptools-scm ];
propagatedBuildInputs = [ hyperkitty postorius whoosh ];
# Tries to check runtime configuration.
doCheck = false;
makeWrapperArgs = [
"--suffix PATH : ${lib.makeBinPath [ sassc ]}"
];
meta = with lib; {
description = "Django project for Mailman 3 web interface";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ qyliss m1cr0man ];
};
}

View file

@ -0,0 +1,33 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation rec {
pname = "mlmmj";
version = "1.3.0";
src = fetchurl {
url = "http://mlmmj.org/releases/${pname}-${version}.tar.gz";
sha256 = "1sghqvwizvm1a9w56r34qy5njaq1c26bagj85r60h32gh3fx02bn";
};
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: getlistdelim.o:/build/mlmmj-1.3.0/src/../include/mlmmj.h:84: multiple definition of
# `subtype_strs'; mlmmj-send.o:/build/mlmmj-1.3.0/src/../include/mlmmj.h:84: first defined here
NIX_CFLAGS_COMPILE = "-fcommon";
postInstall = ''
# grab all documentation files
docfiles=$(find -maxdepth 1 -name "[[:upper:]][[:upper:]]*")
install -vDm 644 -t $out/share/doc/mlmmj/ $docfiles
'';
meta = with lib; {
homepage = "http://mlmmj.org";
description = "Mailing List Management Made Joyful";
maintainers = [ maintainers.edwtjo ];
platforms = platforms.linux;
license = licenses.mit;
};
}

View file

@ -0,0 +1,51 @@
{ stdenv, fetchurl, lib, tls ? true, gnutls ? null }:
assert tls -> gnutls != null;
stdenv.mkDerivation rec {
version = "2.2";
pname = "nullmailer";
src = fetchurl {
url = "https://untroubled.org/nullmailer/nullmailer-${version}.tar.gz";
sha256 = "0md8cf90fl2yf3zh9njjy42a673v4j4ygyq95xg7fzkygdigm1lq";
};
buildInputs = lib.optional tls gnutls;
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
] ++ lib.optional tls "--enable-tls";
installFlags = [ "DESTDIR=$(out)" ];
# We have to remove the ''var'' directory, since nix can't handle named pipes
# and we can't use it in the store anyway. Same for ''etc''.
# The second line is need, because the installer of nullmailer will copy its
# own prepared version of ''etc'' and ''var'' and also uses the prefix path (configure phase)
# for hardcoded absolute references to its own binary farm, e.g. sendmail binary is
# calling nullmailer-inject binary. Since we can't configure inside the store of
# the derivation we need both directories in the root, but don't want to put them there
# during install, hence we have to fix mumbling inside the install directory.
# This is kind of a hack, but the only way I know of, yet.
postInstall = ''
rm -rf $out/var/ $out/etc/
mv $out/$out/* $out/
rmdir $out/$out
'';
enableParallelBuilding = true;
meta = {
homepage = "http://untroubled.org/nullmailer/";
description = ''
A sendmail/qmail/etc replacement MTA for hosts which relay to a fixed set of smart relays.
It is designed to be simple to configure, secure, and easily extendable.
'';
license = lib.licenses.gpl2;
platforms = lib.platforms.all;
maintainers = with lib.maintainers ; [ sargon ];
};
}

View file

@ -0,0 +1,13 @@
diff --git a/configure.ac b/configure.ac
index c215f3bf..f5aa25d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,7 +67,7 @@ AC_C_BIGENDIAN
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LIBTOOL
-AC_PATH_PROG([AR], [ar])
+AC_PATH_TOOL([AR], [ar])
AC_PATH_PROG([CAT], [cat])
AC_PATH_PROG([CHMOD], [chmod])
AC_PATH_PROG([CHOWN], [chown])

View file

@ -0,0 +1,68 @@
{ lib, stdenv, fetchurl, autoconf, automake, libtool, bison
, libasr, libevent, zlib, libressl, db, pam, nixosTests
}:
stdenv.mkDerivation rec {
pname = "opensmtpd";
version = "6.8.0p2";
nativeBuildInputs = [ autoconf automake libtool bison ];
buildInputs = [ libasr libevent zlib libressl db pam ];
src = fetchurl {
url = "https://www.opensmtpd.org/archives/${pname}-${version}.tar.gz";
sha256 = "05sd7bmq29ibnqbl2z53hiyprfxzf0qydfdaixs68rz55wqhbgsi";
};
patches = [
./proc_path.diff # TODO: upstream to OpenSMTPD, see https://github.com/NixOS/nixpkgs/issues/54045
./cross_fix.diff # TODO: remove when https://github.com/OpenSMTPD/OpenSMTPD/pull/1177 will have made it into a release
];
# See https://github.com/OpenSMTPD/OpenSMTPD/issues/885 for the `sh bootstrap`
# requirement
postPatch = ''
substituteInPlace mk/smtpctl/Makefile.am --replace "chgrp" "true"
substituteInPlace mk/smtpctl/Makefile.am --replace "chmod 2555" "chmod 0555"
sh bootstrap
'';
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-mantype=doc"
"--with-auth-pam"
"--without-auth-bsdauth"
"--with-path-socket=/run"
"--with-path-pidfile=/run"
"--with-user-smtpd=smtpd"
"--with-user-queue=smtpq"
"--with-group-queue=smtpq"
"--with-path-CAfile=/etc/ssl/certs/ca-certificates.crt"
"--with-libevent=${libevent.dev}"
"--with-table-db"
];
# See https://github.com/OpenSMTPD/OpenSMTPD/pull/884
makeFlags = [ "CFLAGS=-ffunction-sections" "LDFLAGS=-Wl,--gc-sections" ];
installFlags = [
"sysconfdir=\${out}/etc"
"localstatedir=\${TMPDIR}"
];
meta = with lib; {
homepage = "https://www.opensmtpd.org/";
description = ''
A free implementation of the server-side SMTP protocol as defined by
RFC 5321, with some additional standard extensions
'';
license = licenses.isc;
platforms = platforms.linux;
maintainers = with maintainers; [ obadz ekleog ];
};
passthru.tests = {
basic-functionality-and-dovecot-interaction = nixosTests.opensmtpd;
rspamd-integration = nixosTests.opensmtpd-rspamd;
};
}

View file

@ -0,0 +1,83 @@
{ lib, stdenv, fetchurl, openssl, libevent, libasr, ncurses,
pkg-config, lua5, perl, libmysqlclient, postgresql, sqlite, hiredis,
enableLua ? true,
enablePerl ? true,
enableMysql ? true,
enablePostgres ? true,
enableSqlite ? true,
enableRedis ? true,
}:
stdenv.mkDerivation rec {
pname = "opensmtpd-extras";
version = "6.7.1";
src = fetchurl {
url = "https://www.opensmtpd.org/archives/${pname}-${version}.tar.gz";
sha256 = "1b1mx71bvmv92lbm08wr2p60g3qhikvv3n15zsr6dcwbk9aqahzq";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl libevent
libasr lua5 perl libmysqlclient postgresql sqlite hiredis ];
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-privsep-user=smtpd"
"--with-libevent-dir=${libevent.dev}"
"--with-filter-clamav"
"--with-filter-dkim-signer"
"--with-filter-dnsbl"
"--with-filter-monkey"
"--with-filter-pause"
"--with-filter-regex"
"--with-filter-spamassassin"
"--with-filter-stub"
"--with-filter-trace"
"--with-filter-void"
"--with-queue-null"
"--with-queue-ram"
"--with-queue-stub"
"--with-table-ldap"
"--with-table-socketmap"
"--with-table-passwd"
"--with-table-stub"
"--with-scheduler-ram"
"--with-scheduler-stub"
] ++ lib.optionals enableLua [
"--with-lua=${pkg-config}"
"--with-filter-lua"
] ++ lib.optionals enablePerl [
"--with-perl=${perl}"
"--with-filter-perl"
] ++ lib.optionals enableMysql [
"--with-table-mysql"
] ++ lib.optionals enablePostgres [
"--with-table-postgres"
] ++ lib.optionals enableSqlite [
"--with-table-sqlite"
] ++ lib.optionals enableRedis [
"--with-table-redis"
];
NIX_CFLAGS_COMPILE = lib.optionalString enableRedis
"-I${hiredis}/include/hiredis -lhiredis"
+ lib.optionalString enableMysql
" -L${libmysqlclient}/lib/mysql";
meta = with lib; {
homepage = "https://www.opensmtpd.org/";
description = "Extra plugins for the OpenSMTPD mail server";
license = licenses.isc;
platforms = platforms.linux;
maintainers = with maintainers; [ gebner ekleog ];
};
}

View file

@ -0,0 +1,31 @@
{ lib
, buildGoModule
, fetchFromGitHub
, nixosTests
}:
buildGoModule rec {
pname = "opensmtpd-filter-rspamd";
version = "0.1.7";
src = fetchFromGitHub {
owner = "poolpOrg";
repo = "filter-rspamd";
rev = "v${version}";
sha256 = "pcHj4utpf/AIUv8/7mE8BLbE8LYkzNKfc4T4hIHgGeI=";
};
vendorSha256 = "sNF2c+22FMvKoROkA/3KtSnRdJh4YZLaIx35HD896HI=";
passthru.tests = {
opensmtpd-rspamd-integration = nixosTests.opensmtpd-rspamd;
};
meta = with lib; {
description = "OpenSMTPD filter integration for the Rspamd daemon";
homepage = "https://github.com/poolpOrg/filter-rspamd";
license = licenses.isc;
maintainers = with maintainers; [ Flakebi ];
mainProgram = "filter-rspamd";
};
}

View file

@ -0,0 +1,59 @@
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index e049f07c..a1bd03a0 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1157,6 +1157,7 @@ fork_proc_backend(const char *key, const char *conf, const char *procname)
char path[PATH_MAX];
char name[PATH_MAX];
char *arg;
+ char *proc_path;
if (strlcpy(name, conf, sizeof(name)) >= sizeof(name)) {
log_warnx("warn: %s-proc: conf too long", key);
@@ -1167,7 +1168,12 @@ fork_proc_backend(const char *key, const char *conf, const char *procname)
if (arg)
*arg++ = '\0';
- if (snprintf(path, sizeof(path), PATH_LIBEXEC "/%s-%s", key, name) >=
+ proc_path = getenv("OPENSMTPD_PROC_PATH");
+ if (proc_path == NULL) {
+ proc_path = PATH_LIBEXEC;
+ }
+
+ if (snprintf(path, sizeof(path), "%s/%s-%s", proc_path, key, name) >=
(ssize_t)sizeof(path)) {
log_warn("warn: %s-proc: exec path too long", key);
return (-1);
diff --git a/usr.sbin/smtpd/table.c b/usr.sbin/smtpd/table.c
index 9cfdfb99..24dfcca4 100644
--- a/usr.sbin/smtpd/table.c
+++ b/usr.sbin/smtpd/table.c
@@ -201,6 +201,7 @@ table_create(const char *backend, const char *name, const char *tag,
struct table_backend *tb;
char buf[LINE_MAX];
char path[LINE_MAX];
+ const char *proc_path;
size_t n;
struct stat sb;
@@ -215,11 +216,16 @@ table_create(const char *backend, const char *name, const char *tag,
if (name && table_find(name, NULL))
fatalx("table_create: table \"%s\" already defined", name);
+ proc_path = getenv("OPENSMTPD_PROC_PATH");
+ if (proc_path == NULL) {
+ proc_path = PATH_LIBEXEC;
+ }
+
if ((tb = table_backend_lookup(backend)) == NULL) {
- if ((size_t)snprintf(path, sizeof(path), PATH_LIBEXEC"/table-%s",
- backend) >= sizeof(path)) {
- fatalx("table_create: path too long \""
- PATH_LIBEXEC"/table-%s\"", backend);
+ if ((size_t)snprintf(path, sizeof(path), "%s/table-%s",
+ proc_path, backend) >= sizeof(path)) {
+ fatalx("table_create: path too long \"%s/table-%s\"",
+ proc_path, backend);
}
if (stat(path, &sb) == 0) {
tb = table_backend_lookup("proc");

View file

@ -0,0 +1,28 @@
{ lib, stdenv, fetchurl, flex, bison, sendmailPath ? "/run/wrappers/bin/sendmail" }:
stdenv.mkDerivation rec {
pname = "petidomo";
version = "4.3";
src = fetchurl {
url = "mirror://sourceforge/petidomo/${pname}-${version}.tar.gz";
sha256 = "0x4dbxc4fcfg1rw5ywpcypvylnzn3y4rh0m6fz4h4cdnzb8p1lvm";
};
buildInputs = [ flex bison ];
configureFlags = [ "--with-mta=${sendmailPath}" ];
enableParallelBuilding = true;
doCheck = true;
meta = {
homepage = "http://petidomo.sourceforge.net/";
description = "A simple and easy to administer mailing list server";
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.unix;
maintainers = [ lib.maintainers.peti ];
};
}

View file

@ -0,0 +1,28 @@
{ lib, stdenv, fetchurl, openssl }:
stdenv.mkDerivation rec {
pname = "popa3d";
version = "1.0.3";
src = fetchurl {
url = "http://www.openwall.com/popa3d/${pname}-${version}.tar.gz";
sha256 = "1g48cd74sqhl496wmljhq44iyfpghaz363a1ip8nyhpjz7d57f03";
};
buildInputs = [ openssl ];
patches = [
./fix-mail-spool-path.patch
./use-openssl.patch
./use-glibc-crypt.patch
./enable-standalone-mode.patch
];
configurePhase = ''makeFlags="PREFIX=$out MANDIR=$out/share/man"'';
meta = {
homepage = "http://www.openwall.com/popa3d/";
description = "Tiny POP3 daemon with security as the primary goal";
platforms = lib.platforms.linux;
};
}

View file

@ -0,0 +1,12 @@
diff -ubr popa3d-1.0.2-orig/params.h popa3d-1.0.2/params.h
--- popa3d-1.0.2-orig/params.h 2012-09-19 01:19:56.698098130 +0200
+++ popa3d-1.0.2/params.h 2012-09-19 01:37:06.749130665 +0200
@@ -13,7 +13,7 @@
/*
* Are we going to be a standalone server or start via an inetd clone?
*/
-#define POP_STANDALONE 0
+#define POP_STANDALONE 1
#if POP_STANDALONE

View file

@ -0,0 +1,12 @@
diff -ubr popa3d-1.0.2-orig/params.h popa3d-1.0.2/params.h
--- popa3d-1.0.2-orig/params.h 2012-09-19 01:19:56.698098130 +0200
+++ popa3d-1.0.2/params.h 2012-09-19 01:21:13.748065132 +0200
@@ -191,7 +191,7 @@
*
* #undef this for qmail-style $HOME/Mailbox mailboxes.
*/
-#define MAIL_SPOOL_PATH "/var/mail"
+#define MAIL_SPOOL_PATH "/var/spool/mail"
#ifndef MAIL_SPOOL_PATH
/*

View file

@ -0,0 +1,12 @@
diff -ubr popa3d-1.0.2-orig/Makefile popa3d-1.0.2/Makefile
--- popa3d-1.0.2-orig/Makefile 2012-09-19 01:19:56.698098130 +0200
+++ popa3d-1.0.2/Makefile 2012-09-19 01:24:33.871750473 +0200
@@ -9,7 +9,7 @@
LDFLAGS = -s
LIBS =
# Linux with glibc, FreeBSD, NetBSD
-#LIBS += -lcrypt
+LIBS += -lcrypt
# HP-UX trusted system
#LIBS += -lsec
# Solaris (POP_STANDALONE, POP_VIRTUAL)

View file

@ -0,0 +1,21 @@
diff -ubr popa3d-1.0.2-orig/Makefile popa3d-1.0.2/Makefile
--- popa3d-1.0.2-orig/Makefile 2012-09-19 01:19:56.698098130 +0200
+++ popa3d-1.0.2/Makefile 2012-09-19 01:23:00.309636423 +0200
@@ -5,7 +5,7 @@
INSTALL = install -c
CFLAGS = -Wall -O2 -fomit-frame-pointer
# You may use OpenSSL's MD5 routines instead of the ones supplied here
-#CFLAGS += -DHAVE_OPENSSL
+CFLAGS += -DHAVE_OPENSSL
LDFLAGS = -s
LIBS =
# Linux with glibc, FreeBSD, NetBSD
@@ -21,7 +21,7 @@
# libwrap may also want this
#LIBS += -lnsl
# OpenSSL (-DHAVE_OPENSSL)
-#LIBS += -lcrypto
+LIBS += -lcrypto
DESTDIR =
PREFIX = /usr/local

View file

@ -0,0 +1,54 @@
From bf269dda3c81bb9eaa244b3015d426de38c85ccf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Carles=20Pag=C3=A8s?= <page@ruiec.cat>
Date: Fri, 3 Mar 2017 09:59:09 +0100
Subject: [PATCH] Fix build with unbound 1.6.1
From their changelog: Fix to rename ub_callback_t to ub_callback_type, because POSIX reserves _t typedefs
---
postlicyd/dns.c | 2 +-
postlicyd/dns.h | 2 +-
postlicyd/spf-proto.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/postlicyd/dns.c b/postlicyd/dns.c
index d8409c2..97f1c4d 100644
--- a/postlicyd/dns.c
+++ b/postlicyd/dns.c
@@ -123,7 +123,7 @@ static int dns_handler(client_t *event, void *config)
}
bool dns_resolve(const char *hostname, dns_rrtype_t type,
- ub_callback_t callback, void *data)
+ ub_callback_type callback, void *data)
{
if (_G.ctx == NULL) {
_G.ctx = ub_ctx_create();
diff --git a/postlicyd/dns.h b/postlicyd/dns.h
index d84de3b..905b924 100644
--- a/postlicyd/dns.h
+++ b/postlicyd/dns.h
@@ -89,7 +89,7 @@ typedef void (*dns_result_callback_f)(dns_result_t *result, void *data);
*/
__attribute__((nonnull(1,3,4)))
bool dns_resolve(const char *hostname, dns_rrtype_t type,
- ub_callback_t callback, void *data);
+ ub_callback_type callback, void *data);
/** Fetch the DNS record of the given type.
*/
diff --git a/postlicyd/spf-proto.c b/postlicyd/spf-proto.c
index 31cb0a5..79a2d83 100644
--- a/postlicyd/spf-proto.c
+++ b/postlicyd/spf-proto.c
@@ -279,7 +279,7 @@ static bool spf_validate_domain(const char* restrict domain)
}
static bool spf_query(spf_t *spf, const char* query, dns_rrtype_t rtype,
- ub_callback_t cb)
+ ub_callback_type cb)
{
buffer_reset(&_G.query_buffer);
buffer_addstr(&_G.query_buffer, query);
--
2.12.0

View file

@ -0,0 +1,113 @@
{ stdenv, lib, fetchurl, makeWrapper, gnused, db, openssl, cyrus_sasl, libnsl
, coreutils, findutils, gnugrep, gawk, icu, pcre, m4
, fetchpatch
, buildPackages, nixosTests
, withLDAP ? true, openldap
, withPgSQL ? false, postgresql
, withMySQL ? false, libmysqlclient
, withSQLite ? false, sqlite
}:
let
ccargs = lib.concatStringsSep " " ([
"-DUSE_TLS" "-DUSE_SASL_AUTH" "-DUSE_CYRUS_SASL" "-I${cyrus_sasl.dev}/include/sasl"
"-DHAS_DB_BYPASS_MAKEDEFS_CHECK"
] ++ lib.optional withPgSQL "-DHAS_PGSQL"
++ lib.optionals withMySQL [ "-DHAS_MYSQL" "-I${libmysqlclient.dev}/include/mysql" "-L${libmysqlclient}/lib/mysql" ]
++ lib.optional withSQLite "-DHAS_SQLITE"
++ lib.optionals withLDAP ["-DHAS_LDAP" "-DUSE_LDAP_SASL"]);
auxlibs = lib.concatStringsSep " " ([
"-ldb" "-lnsl" "-lresolv" "-lsasl2" "-lcrypto" "-lssl"
] ++ lib.optional withPgSQL "-lpq"
++ lib.optional withMySQL "-lmysqlclient"
++ lib.optional withSQLite "-lsqlite3"
++ lib.optional withLDAP "-lldap");
in stdenv.mkDerivation rec {
pname = "postfix";
version = "3.6.6";
src = fetchurl {
url = "http://cdn.postfix.johnriley.me/mirrors/postfix-release/official/${pname}-${version}.tar.gz";
hash = "sha256-CYpxT0EEaO/ibiGR3I8xy6RQfVv0iPVvnrVUXjaG8NY=";
};
nativeBuildInputs = [ makeWrapper m4 ];
buildInputs = [ db openssl cyrus_sasl icu libnsl pcre ]
++ lib.optional withPgSQL postgresql
++ lib.optional withMySQL libmysqlclient
++ lib.optional withSQLite sqlite
++ lib.optional withLDAP openldap;
hardeningDisable = [ "format" ];
hardeningEnable = [ "pie" ];
patches = [
./postfix-script-shell.patch
./postfix-3.0-no-warnings.patch
./post-install-script.patch
./relative-symlinks.patch
# glibc 2.34 compat
(fetchpatch {
url = "https://src.fedoraproject.org/rpms/postfix/raw/2f9d42453e67ebc43f786d98262a249037f80a77/f/postfix-3.6.2-glibc-234-build-fix.patch";
sha256 = "sha256-xRUL5gaoIt6HagGlhsGwvwrAfYvzMgydsltYMWvl9BI=";
})
];
postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
sed -e 's!bin/postconf!${buildPackages.postfix}/bin/postconf!' -i postfix-install
'' + ''
sed -e '/^PATH=/d' -i postfix-install
sed -e "s|@PACKAGE@|$out|" -i conf/post-install
# post-install need skip permissions check/set on all symlinks following to /nix/store
sed -e "s|@NIX_STORE@|$NIX_STORE|" -i conf/post-install
'';
postConfigure = ''
export command_directory=$out/sbin
export config_directory=/etc/postfix
export meta_directory=$out/etc/postfix
export daemon_directory=$out/libexec/postfix
export data_directory=/var/lib/postfix/data
export html_directory=$out/share/postfix/doc/html
export mailq_path=$out/bin/mailq
export manpage_directory=$out/share/man
export newaliases_path=$out/bin/newaliases
export queue_directory=/var/lib/postfix/queue
export readme_directory=$out/share/postfix/doc
export sendmail_path=$out/bin/sendmail
makeFlagsArray+=(AR=$AR _AR=$AR RANLIB=$RANLIB _RANLIB=$RANLIB)
make makefiles CCARGS='${ccargs}' AUXLIBS='${auxlibs}'
'';
NIX_LDFLAGS = lib.optionalString withLDAP "-llber";
installTargets = [ "non-interactive-package" ];
installFlags = [ "install_root=installdir" ];
postInstall = ''
mkdir -p $out
mv -v installdir/$out/* $out/
cp -rv installdir/etc $out
sed -e '/^PATH=/d' -i $out/libexec/postfix/post-install
wrapProgram $out/libexec/postfix/post-install \
--prefix PATH ":" ${lib.makeBinPath [ coreutils findutils gnugrep ]}
wrapProgram $out/libexec/postfix/postfix-script \
--prefix PATH ":" ${lib.makeBinPath [ coreutils findutils gnugrep gawk gnused ]}
'';
passthru.tests = { inherit (nixosTests) postfix postfix-raise-smtpd-tls-security-level; };
meta = with lib; {
homepage = "http://www.postfix.org/";
description = "A fast, easy to administer, and secure mail server";
license = with licenses; [ ipl10 epl20 ];
platforms = platforms.linux;
maintainers = with maintainers; [ globin dotlambda lewo ];
};
}

View file

@ -0,0 +1,56 @@
{ stdenv, lib, fetchFromGitHub, git, gperf, pcre, unbound, libev, tokyocabinet, pkg-config, bash, libsrs2 }:
let
version = "0.9";
pfixtoolsSrc = fetchFromGitHub {
owner = "Fruneau";
repo = "pfixtools";
rev = "pfixtools-${version}";
sha256 = "1vmbrw686f41n6xfjphfshn96vl07ynvnsyjdw9yfn9bfnldcjcq";
};
srcRoot = pfixtoolsSrc.name;
libCommonSrc = fetchFromGitHub {
owner = "Fruneau";
repo = "libcommon";
rev = "b07e6bdea3d24748e0d39783d7d817096d10cc67";
sha256 = "14fxldp29j4vmfmhfgwwi37pj8cz0flm1aykkxlbgakz92d4pm35";
};
in
stdenv.mkDerivation {
pname = "pfixtools";
inherit version;
src = pfixtoolsSrc;
patches = [ ./0001-Fix-build-with-unbound-1.6.1.patch ];
nativeBuildInputs = [ pkg-config ];
buildInputs = [git gperf pcre unbound libev tokyocabinet bash libsrs2];
postUnpack = ''
cp -Rp ${libCommonSrc}/* ${srcRoot}/common;
chmod -R +w ${srcRoot}/common;
'';
postPatch = ''
substituteInPlace postlicyd/policy_tokens.sh \
--replace /bin/bash ${bash}/bin/bash;
'';
NIX_CFLAGS_COMPILE = "-Wno-error=unused-result -Wno-error=nonnull-compare -Wno-error=format-truncation";
makeFlags = [ "DESTDIR=$(out)" "prefix=" ];
meta = {
description = "A collection of postfix-related tools";
license = with lib.licenses; [ bsd3 ];
homepage = "https://github.com/Fruneau/pfixtools";
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ jerith666 ];
};
}

View file

@ -0,0 +1,34 @@
{ lib, fetchurl, perlPackages }:
perlPackages.buildPerlPackage rec {
pname = "pflogsumm";
version = "1.1.3";
src = fetchurl {
url = "https://jimsun.linxnet.com/downloads/${pname}-${version}.tar.gz";
sha256 = "0hkim9s5f1yg5sfs5048jydhy3sbxafls496wcjk0cggxb113py4";
};
outputs = [ "out" "man" ];
buildInputs = [ perlPackages.DateCalc ];
preConfigure = ''
touch Makefile.PL
'';
doCheck = false;
installPhase = ''
mkdir -p "$out/bin"
mv "pflogsumm.pl" "$out/bin/pflogsumm"
mkdir -p "$out/share/man/man1"
mv "pflogsumm.1" "$out/share/man/man1"
'';
meta = {
homepage = "http://jimsun.linxnet.com/postfix_contrib.html";
maintainers = with lib.maintainers; [ schneefux ];
description = "Postfix activity overview";
license = lib.licenses.gpl2Plus;
};
}

View file

@ -0,0 +1,28 @@
--- a/conf/post-install 1970-01-01 03:00:01.000000000 +0300
+++ b/conf/post-install 2016-01-20 13:25:18.382233172 +0200
@@ -254,6 +254,8 @@
}
# Bootstrapping problem.
+meta_directory="@PACKAGE@/etc/postfix"
+command_directory="@PACKAGE@/bin"
if [ -n "$command_directory" ]
then
@@ -528,7 +530,16 @@
# Skip uninstalled files.
case $path in
no|no/*) continue;;
+ # Skip immutable files from package, correct permissions provided by Nix.
+ @PACKAGE@/*) continue;
esac
+ # Also skip symlinks following to /nix/store
+ if test -L $path; then
+ case "$(readlink $path)" in
+ @NIX_STORE@/*) continue;
+ esac
+ fi
+
# Pick up the flags.
case $flags in *u*) upgrade_flag=1;; *) upgrade_flag=;; esac
case $flags in *c*) create_flag=1;; *) create_flag=;; esac

View file

@ -0,0 +1,86 @@
diff -ru3 postfix-3.0.3/conf/postfix-script postfix-3.0.3-new/conf/postfix-script
--- postfix-3.0.3/conf/postfix-script 2014-06-27 18:05:15.000000000 +0400
+++ postfix-3.0.3-new/conf/postfix-script 2016-01-09 17:51:38.545733631 +0300
@@ -84,24 +84,6 @@
exit 1
}
-# If this is a secondary instance, don't touch shared files.
-
-instances=`test ! -f $def_config_directory/main.cf ||
- $command_directory/postconf -c $def_config_directory \
- -h multi_instance_directories | sed 's/,/ /'` || {
- $FATAL cannot execute $command_directory/postconf!
- exit 1
-}
-
-check_shared_files=1
-for name in $instances
-do
- case "$name" in
- "$def_config_directory") ;;
- "$config_directory") check_shared_files=; break;;
- esac
-done
-
#
# Parse JCL
#
@@ -262,22 +244,6 @@
-prune \( -perm -020 -o -perm -002 \) \
-exec $WARN group or other writable: {} \;
- # Check Postfix root-owned directory tree owner/permissions.
-
- todo="$config_directory/."
- test -n "$check_shared_files" && {
- todo="$daemon_directory/. $meta_directory/. $todo"
- test "$shlib_directory" = "no" ||
- todo="$shlib_directory/. $todo"
- }
- todo=`echo "$todo" | tr ' ' '\12' | sort -u`
-
- find $todo ! -user root \
- -exec $WARN not owned by root: {} \;
-
- find $todo \( -perm -020 -o -perm -002 \) \
- -exec $WARN group or other writable: {} \;
-
# Check Postfix mail_owner-owned directory tree owner/permissions.
find $data_directory/. ! -user $mail_owner \
@@ -302,18 +268,11 @@
# Check Postfix setgid_group-owned directory and file group/permissions.
todo="$queue_directory/public $queue_directory/maildrop"
- test -n "$check_shared_files" &&
- todo="$command_directory/postqueue $command_directory/postdrop $todo"
find $todo \
-prune ! -group $setgid_group \
-exec $WARN not owned by group $setgid_group: {} \;
- test -n "$check_shared_files" &&
- find $command_directory/postqueue $command_directory/postdrop \
- -prune ! -perm -02111 \
- -exec $WARN not set-gid or not owner+group+world executable: {} \;
-
# Check non-Postfix root-owned directory tree owner/content.
for dir in bin etc lib sbin usr
@@ -334,15 +293,6 @@
find corrupt -type f -exec $WARN damaged message: {} \;
- # Check for non-Postfix MTA remnants.
-
- test -n "$check_shared_files" -a -f /usr/sbin/sendmail -a \
- -f /usr/lib/sendmail && {
- cmp -s /usr/sbin/sendmail /usr/lib/sendmail || {
- $WARN /usr/lib/sendmail and /usr/sbin/sendmail differ
- $WARN Replace one by a symbolic link to the other
- }
- }
exit 0
;;

View file

@ -0,0 +1,21 @@
diff --git a/conf/postfix-script b/conf/postfix-script
index 19088a6..04fae23 100755
--- a/conf/postfix-script
+++ b/conf/postfix-script
@@ -43,7 +43,6 @@ FATAL="$LOGGER -p fatal"
PANIC="$LOGGER -p panic"
umask 022
-SHELL=/bin/sh
#
# Can't do much without these in place.
@@ -229,7 +228,7 @@ status)
check-fatal)
# This command is NOT part of the public interface.
- $SHELL $daemon_directory/post-install create-missing || {
+ $daemon_directory/post-install create-missing || {
$FATAL unable to create missing queue directories
exit 1
}

View file

@ -0,0 +1,13 @@
diff --git a/postfix-install b/postfix/postfix-install
index 1662c3d..0f20ec0 100644
--- a/postfix-install
+++ b/postfix-install
@@ -336,7 +336,7 @@ compare_or_symlink() {
# 2) we cannot use mv to replace a symlink-to-directory;
# 3) "ln -n" is not in POSIX, therefore it's not portable.
# rm+ln is less atomic but this affects compatibility symlinks only.
- rm -f $2 && ln -sf $link $2 || exit 1
+ rm -f $2 && ln -rsf $link $2 || exit 1
}
}

View file

@ -0,0 +1,34 @@
{ fetchurl, perlPackages, lib, runCommand, postfix }:
let
mk-perl-flags = inputs: lib.concatStringsSep " " (map (dep: "-I ${dep}/${perlPackages.perl.libPrefix}") inputs);
postgrey-flags = mk-perl-flags (with perlPackages; [
NetServer BerkeleyDB DigestSHA1 NetAddrIP IOMultiplex
]);
policy-test-flags = mk-perl-flags (with perlPackages; [
ParseSyslog
]);
version = "1.37";
name = "postgrey-${version}";
in runCommand name {
src = fetchurl {
url = "https://postgrey.schweikert.ch/pub/${name}.tar.gz";
sha256 = "1xx51xih4711vrvc6d57il9ccallbljj5zhgqdb07jzmz11rakgz";
};
meta = with lib; {
description = "A postfix policy server to provide greylisting";
homepage = "https://postgrey.schweikert.ch/";
platforms = postfix.meta.platforms;
license = licenses.gpl2;
};
} ''
mkdir -p $out/bin
cd $out
tar -xzf $src --strip-components=1
mv postgrey policy-test bin
sed -i -e "s,#!/usr/bin/perl -T,#!${perlPackages.perl}/bin/perl -T ${postgrey-flags}," \
-e "s#/etc/postfix#$out#" \
bin/postgrey
sed -i -e "s,#!/usr/bin/perl,#!${perlPackages.perl}/bin/perl ${policy-test-flags}," \
bin/policy-test
''

View file

@ -0,0 +1,29 @@
{ lib, stdenv, fetchFromGitHub, cmake, help2man }:
stdenv.mkDerivation rec {
pname = "postsrsd";
version = "1.11";
src = fetchFromGitHub {
owner = "roehling";
repo = "postsrsd";
rev = version;
sha256 = "sha256-M1VtH+AToLh9J4zwIznInfFJzqmKElTvqAgI+qqL+Lw=";
};
cmakeFlags = [ "-DGENERATE_SRS_SECRET=OFF" "-DINIT_FLAVOR=systemd" ];
preConfigure = ''
sed -i "s,\"/etc\",\"$out/etc\",g" CMakeLists.txt
'';
nativeBuildInputs = [ cmake help2man ];
meta = with lib; {
homepage = "https://github.com/roehling/postsrsd";
description = "Postfix Sender Rewriting Scheme daemon";
license = licenses.gpl2;
platforms = platforms.all;
maintainers = with maintainers; [ abbradar ];
};
}

View file

@ -0,0 +1,161 @@
{ stdenv, lib, fetchurl, makeWrapper, nixosTests
, buildPerlPackage
, coreutils
, curl
, git
, gnumake
, highlight
, libgit2
, man
, openssl
, pkg-config
, sqlite
, xapian
, AnyURIEscape
, DBDSQLite
, DBI
, EmailAddressXS
, EmailMIME
, IOSocketSSL
, IPCRun
, Inline
, InlineC
, LinuxInotify2
, MailIMAPClient
, ParseRecDescent
, Plack
, PlackMiddlewareReverseProxy
, SearchXapian
, TimeDate
, URI
}:
let
skippedTests = [
# These tests would fail, and produce "Operation not permitted"
# errors from git, because they use git init --shared. This tries
# to set the setgid bit, which isn't permitted inside build
# sandboxes.
#
# These tests were indentified with
# grep -r shared t/
"convert-compact" "search" "v2writable" "www_listing"
# perl5.32.0-public-inbox> t/eml.t ...................... 1/? Cannot parse parameter '=?ISO-8859-1?Q?=20charset=3D=1BOF?=' at t/eml.t line 270.
# perl5.32.0-public-inbox> # Failed test 'got wide character by assuming utf-8'
# perl5.32.0-public-inbox> # at t/eml.t line 272.
# perl5.32.0-public-inbox> Wide character in print at /nix/store/38vxlxrvg3yji3jms44qn94lxdysbj5j-perl-5.32.0/lib/perl5/5.32.0/Test2/Formatter/TAP.pm line 125.
"eml"
# Failed test 'Makefile OK'
# at t/hl_mod.t line 19.
# got: 'makefile'
# expected: 'make'
"hl_mod"
# Failed test 'clone + index v1 synced ->created_at'
# at t/lei-mirror.t line 175.
# got: '1638378723'
# expected: undef
# Failed test 'clone + index v1 synced ->created_at'
# at t/lei-mirror.t line 178.
# got: '1638378723'
# expected: undef
# May be due to the use of $ENV{HOME}.
"lei-mirror"
# Failed test 'child error (pure-Perl)'
# at t/spawn.t line 33.
# got: '0'
# expected: anything else
# waiting for child to reap grandchild...
"spawn"
];
testConditions = with lib;
concatMapStringsSep " " (n: "! -name ${escapeShellArg n}.t") skippedTests;
in
buildPerlPackage rec {
pname = "public-inbox";
version = "1.8.0";
src = fetchurl {
url = "https://public-inbox.org/public-inbox.git/snapshot/public-inbox-${version}.tar.gz";
sha256 = "sha256-laJOOCk5NecIGWesv4D30cLGfijQHVkeo55eNqNKzew=";
};
outputs = [ "out" "devdoc" "sa_config" ];
postConfigure = ''
substituteInPlace Makefile --replace 'TEST_FILES = t/*.t' \
'TEST_FILES = $(shell find t -name *.t ${testConditions})'
substituteInPlace lib/PublicInbox/TestCommon.pm \
--replace /bin/cp ${coreutils}/bin/cp
'';
nativeBuildInputs = [ makeWrapper ];
buildInputs = [
AnyURIEscape
DBDSQLite
DBI
EmailAddressXS
EmailMIME
highlight
IOSocketSSL
IPCRun
Inline
InlineC
ParseRecDescent
Plack
PlackMiddlewareReverseProxy
SearchXapian
TimeDate
URI
libgit2 # For Gcf2
man
];
doCheck = !stdenv.isDarwin;
checkInputs = [
MailIMAPClient
curl
git
openssl
pkg-config
sqlite
xapian
] ++ lib.optionals stdenv.isLinux [
LinuxInotify2
];
preCheck = ''
perl certs/create-certs.perl
export TEST_LEI_ERR_LOUD=1
export HOME="$NIX_BUILD_TOP"/home
mkdir -p "$HOME"/.cache/public-inbox/inline-c
'';
installTargets = [ "install" ];
postInstall = ''
for prog in $out/bin/*; do
wrapProgram $prog --prefix PATH : ${lib.makeBinPath [
git
/* for InlineC */
gnumake
stdenv.cc.cc
]}
done
mv sa_config $sa_config
'';
passthru.tests = {
nixos-public-inbox = nixosTests.public-inbox;
};
meta = with lib; {
homepage = "https://public-inbox.org/";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ julm qyliss ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,26 @@
{ lib, buildPythonApplication, fetchurl, pyspf }:
buildPythonApplication rec {
pname = "pypolicyd-spf";
majorVersion = "2.0";
version = "${majorVersion}.2";
src = fetchurl {
url = "https://launchpad.net/pypolicyd-spf/${majorVersion}/${version}/+download/${pname}-${version}.tar.gz";
sha256 = "1nm8y1jjgx6mxrbcxrbdnmkf8vglwp0wiw6jipzh641wb24gi76z";
};
propagatedBuildInputs = [ pyspf ];
preBuild = ''
substituteInPlace setup.py --replace "'/etc'" "'$out/etc'"
'';
meta = with lib; {
homepage = "https://launchpad.net/pypolicyd-spf/";
description = "Postfix policy engine for Sender Policy Framework (SPF) checking";
maintainers = with maintainers; [ abbradar ];
license = licenses.asl20;
platforms = platforms.all;
};
}

View file

@ -0,0 +1,50 @@
{ stdenv, lib, fetchFromGitHub, cmake, perl
, glib, luajit, openssl, pcre2, pkg-config, sqlite, ragel, icu
, hyperscan, jemalloc, blas, lapack, lua, libsodium
, withBlas ? true
, withHyperscan ? stdenv.isx86_64
, withLuaJIT ? stdenv.isx86_64
, nixosTests
}:
assert withHyperscan -> stdenv.isx86_64;
stdenv.mkDerivation rec {
pname = "rspamd";
version = "3.2";
src = fetchFromGitHub {
owner = "rspamd";
repo = "rspamd";
rev = version;
sha256 = "122d5m1nfxxz93bhsk8lm4dazvdknzphb0a1188m7bsa4iynbfv2";
};
hardeningEnable = [ "pie" ];
nativeBuildInputs = [ cmake pkg-config perl ];
buildInputs = [ glib openssl pcre2 sqlite ragel icu jemalloc libsodium ]
++ lib.optional withHyperscan hyperscan
++ lib.optionals withBlas [ blas lapack ]
++ lib.optional withLuaJIT luajit ++ lib.optional (!withLuaJIT) lua;
cmakeFlags = [
"-DDEBIAN_BUILD=ON"
"-DRUNDIR=/run/rspamd"
"-DDBDIR=/var/lib/rspamd"
"-DLOGDIR=/var/log/rspamd"
"-DLOCAL_CONFDIR=/etc/rspamd"
"-DENABLE_JEMALLOC=ON"
] ++ lib.optional withHyperscan "-DENABLE_HYPERSCAN=ON"
++ lib.optional (!withLuaJIT) "-DENABLE_LUAJIT=OFF";
passthru.tests.rspamd = nixosTests.rspamd;
meta = with lib; {
homepage = "https://rspamd.com";
license = licenses.asl20;
description = "Advanced spam filtering system";
maintainers = with maintainers; [ avnik fpletz globin lewo ];
platforms = with platforms; linux;
};
}

View file

@ -0,0 +1,50 @@
{ lib, fetchurl, perlPackages, makeWrapper, gnupg, re2c, gcc, gnumake }:
perlPackages.buildPerlPackage rec {
pname = "SpamAssassin";
version = "3.4.6";
src = fetchurl {
url = "mirror://apache/spamassassin/source/Mail-${pname}-${version}.tar.bz2";
sha256 = "044ng2aazqy8g0m17q0a4939ck1ca4x230q2q7q7jndvwkrpaj5w";
};
# ExtUtil::MakeMaker is bundled with Perl, but the bundled version
# causes build errors for aarch64-darwin, so we override it with the
# latest version. We can drop the dependency to go back to the
# bundled version when the version that comes with Perl is ≥7.57_02.
#
# Check the version bundled with Perl like this:
# perl -e 'use ExtUtils::MakeMaker qw($VERSION); print "$VERSION\n"'
nativeBuildInputs = [ makeWrapper perlPackages.ExtUtilsMakeMaker ];
buildInputs = (with perlPackages; [
HTMLParser NetCIDRLite NetDNS NetAddrIP DBFile HTTPDate MailDKIM LWP
LWPProtocolHttps IOSocketSSL DBI EncodeDetect IPCountry NetIdent
Razor2ClientAgent MailSPF NetDNSResolverProgrammable Socket6
]);
# Enabling 'taint' mode is desirable, but that flag disables support
# for the PERL5LIB environment variable. Needs further investigation.
makeFlags = [ "PERL_BIN=${perlPackages.perl}/bin/perl" "PERL_TAINT=no" ];
makeMakerFlags = [ "SYSCONFDIR=/etc LOCALSTATEDIR=/var/lib/spamassassin" ];
doCheck = false;
postInstall = ''
mkdir -p $out/share/spamassassin
mv "rules/"* $out/share/spamassassin/
for n in "$out/bin/"*; do
wrapProgram "$n" --prefix PERL5LIB : "$PERL5LIB" --prefix PATH : ${lib.makeBinPath [ gnupg re2c gcc gnumake ]}
done
'';
meta = {
homepage = "https://spamassassin.apache.org/";
description = "Open-Source Spam Filter";
license = lib.licenses.asl20;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ qknight qyliss ];
};
}

View file

@ -0,0 +1,44 @@
From 60abf3ee8864980a95b32e2d6cf60e26b49654c0 Mon Sep 17 00:00:00 2001
From: joachim schiele <js@lastlog.de>
Date: Wed, 7 Jun 2017 22:15:39 +0200
Subject: [PATCH 2/2] Adding --siteconfigpath to not be forced to use global /etc/spamasassin configuration directory but to provide an alternative location.
---
sa-update.raw | 5 +++++
lib/Mail/SpamAssassin/PerMsgStatus.pm | 2 +
2 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sa-update.raw b/sa-update.raw
index bb7396d..39f681f 100755
--- a/sa-update.raw
+++ b/sa-update.raw
@@ -196,6 +196,7 @@ GetOptions(
'gpgkeyfile=s' => \$opt{'gpgkeyfile'},
'channelfile=s' => \$opt{'channelfile'},
'updatedir=s' => \$opt{'updatedir'},
+ 'siteconfigpath=s' => \$opt{'siteconfigpath'},
'gpg!' => \$GPG_ENABLED,
'4' => sub { $opt{'force_pf'} = 'inet' },
@@ -267,6 +268,9 @@ else {
$opt{'updatedir'} = $SA->sed_path('__local_state_dir__/__version__');
}
+if (defined $opt{'siteconfigpath'}) {
+ $LOCAL_RULES_DIR = untaint_file_path($opt{'siteconfigpath'});
+}
# check only disabled gpg
# https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5854
@@ -1808,7 +1812,7 @@ Options:
--updatedir path Directory to place updates, defaults to the
SpamAssassin site rules directory
(default: @@LOCAL_STATE_DIR@@/@@VERSION@@)
+ --siteconfigpath=path Path for site configs
--refreshmirrors Force the MIRRORED.BY file to be updated
-D, --debug [area=n,...] Print debugging messages
-v, --verbose Be verbose, like print updated channel names;
--
2.12.2

View file

@ -0,0 +1,118 @@
{ lib, stdenv, perl, fetchFromGitHub, autoreconfHook, nixosTests }:
let
dataDir = "/var/lib/sympa";
runtimeDir = "/run/sympa";
perlEnv = perl.withPackages (p: with p; [
ArchiveZip
CGI
CGIFast
ClassSingleton
DateTime
DBI
DateTimeFormatMail
DateTimeTimeZone
Encode
FCGI
FileCopyRecursive
FileNFSLock
FilePath
HTMLParser
HTMLFormatter
HTMLTree
HTMLStripScriptsParser
IO
IOStringy
LWP
libintl-perl
MHonArc
MIMECharset
MIMETools
MIMEEncWords
MIMELiteHTML
MailTools
NetCIDR
ScalarListUtils
SysSyslog
TermProgressBar
TemplateToolkit
URI
UnicodeLineBreak
XMLLibXML
### Features
Clone
CryptEksblowfish
DBDPg
DBDSQLite
DBDmysql
DataPassword
EncodeLocale
IOSocketSSL
MailDKIM
NetDNS
perlldap
libnet
SOAPLite
]);
in
stdenv.mkDerivation rec {
pname = "sympa";
version = "6.2.68";
src = fetchFromGitHub {
owner = "sympa-community";
repo = pname;
rev = version;
sha256 = "sha256-biTF2We9/ZBFBNpltyJonAe5tpXz+eNam+Bu6esJPiY=";
};
configureFlags = [
"--enable-fhs"
"--without-initdir"
"--without-unitsdir"
"--without-smrshdir"
"--with-lockdir=${runtimeDir}"
"--with-piddir=${runtimeDir}"
"--with-confdir=${dataDir}/etc"
"--sysconfdir=${dataDir}/etc"
"--with-spooldir=${dataDir}/spool"
"--with-expldir=${dataDir}/list_data"
];
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [ perlEnv ];
patches = [ ./make-docs.patch ];
prePatch = ''
patchShebangs po/sympa/add-lang.pl
'';
preInstall = ''
mkdir "$TMP/bin"
for i in chown chgrp chmod; do
echo '#!${stdenv.shell}' >> "$TMP/bin/$i"
chmod +x "$TMP/bin/$i"
done
PATH="$TMP/bin:$PATH"
'';
postInstall = ''
rm -rf "$TMP/bin"
'';
passthru.tests = {
inherit (nixosTests) sympa;
};
meta = with lib; {
description = "Open source mailing list manager";
homepage = "https://www.sympa.org";
license = licenses.gpl2;
maintainers = with maintainers; [ sorki mmilata ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,11 @@
diff -ur sympa-6.2.44-orig/doc/Makefile.am sympa-6.2.44/doc/Makefile.am
--- sympa-6.2.44-orig/doc/Makefile.am 2019-08-29 01:57:43.512539087 +0200
+++ sympa-6.2.44/doc/Makefile.am 2019-08-29 01:58:24.393531358 +0200
@@ -83,6 +83,4 @@
--lax --release="$(VERSION)" $< $@
.podpl.pod:
- $(AM_V_GEN)PERL5LIB=$(top_builddir)/src/lib:$(top_srcdir)/src/lib; \
- export PERL5LIB; \
- $(PERL) $< --top_srcdir=$(top_srcdir) > $*.pod
+ $(AM_V_GEN)$(PERL) -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib $< --top_srcdir=$(top_srcdir) > $*.pod

View file

@ -0,0 +1,40 @@
{ lib, stdenv, writeText, runtimeShell }:
let script = writeText "script" ''
#!${runtimeShell}
if command -v sendmail > /dev/null 2>&1 && [ "$(command -v sendmail)" != "{{MYPATH}}" ]; then
exec sendmail "$@"
elif [ -x /run/wrappers/bin/sendmail ]; then
exec /run/wrappers/bin/sendmail "$@"
elif [ -x /run/current-system/sw/bin/sendmail ]; then
exec /run/current-system/sw/bin/sendmail "$@"
else
echo "Unable to find system sendmail." >&2
exit 1
fi
''; in
stdenv.mkDerivation {
pname = "system-sendmail";
version = "1.0";
src = script;
dontUnpack = true;
dontInstall = true;
buildPhase = ''
mkdir -p $out/bin
< $src sed "s#{{MYPATH}}#$out/bin/sendmail#" > $out/bin/sendmail
chmod +x $out/bin/sendmail
'';
meta = with lib; {
description = ''
A sendmail wrapper that calls the system sendmail. Do not install as system-wide sendmail!
'';
platforms = platforms.unix;
maintainers = with maintainers; [ ekleog ];
mainProgram = "sendmail";
};
}