summary refs log tree commit diff
path: root/pkgs/servers/mail/mailman/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers/mail/mailman/default.nix')
-rw-r--r--pkgs/servers/mail/mailman/default.nix57
1 files changed, 36 insertions, 21 deletions
diff --git a/pkgs/servers/mail/mailman/default.nix b/pkgs/servers/mail/mailman/default.nix
index e9f66b92be2..8e763800f65 100644
--- a/pkgs/servers/mail/mailman/default.nix
+++ b/pkgs/servers/mail/mailman/default.nix
@@ -1,33 +1,48 @@
-{ stdenv, fetchurl, python2 }:
+{ stdenv, buildPythonPackage, fetchPypi, isPy3k, alembic, aiosmtpd, dnspython
+, flufl_bounce, flufl_i18n, flufl_lock, lazr_config, lazr_delegates, passlib
+, requests, zope_configuration, click, falcon, importlib-resources
+, zope_component, lynx, postfix, authheaders, gunicorn
+}:
 
-stdenv.mkDerivation rec {
+buildPythonPackage rec {
   pname = "mailman";
-  version = "2.1.29";
+  version = "3.3.0";
+  disabled = !isPy3k;
 
-  src = fetchurl {
-    url = "mirror://gnu/mailman/${pname}-${version}.tgz";
-    sha256 = "0b0dpwf6ap260791c7lg2vpw30llf19hymbf2hja3s016rqp5243";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1qph9i93ndahfxi3bb2sd0kjm2c0pkh844ai6zacfmvihl1k3pvy";
   };
 
-  buildInputs = [ python2 python2.pkgs.dnspython ];
-
-  patches = [ ./fix-var-prefix.patch ];
-
-  configureFlags = [
-    "--without-permcheck"
-    "--with-cgi-ext=.cgi"
-    "--with-var-prefix=/var/lib/mailman"
+  propagatedBuildInputs = [
+    alembic aiosmtpd click dnspython falcon flufl_bounce flufl_i18n flufl_lock
+    importlib-resources lazr_config passlib requests zope_configuration
+    zope_component authheaders gunicorn
   ];
 
-  installTargets = "doinstall"; # Leave out the 'update' target that's implied by 'install'.
-
-  makeFlags = [ "DIRSETGID=:" ];
+  patchPhase = ''
+    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. The proper way to use mailman is
+  # to create a specialized python interpreter:
+  #
+  #   python37.withPackages (ps: [ps.mailman])
+  #
+  # This gives a properly wrapped 'mailman' command plus an interpreter that
+  # has all the necessary search paths to execute unwrapped 'master' and
+  # 'runner' scripts. The setup is a little tricky, but fortunately NixOS is
+  # about to get a OS module that takes care of those details.
+  dontWrapPythonPrograms = true;
 
   meta = {
     homepage = https://www.gnu.org/software/mailman/;
-    description = "Free software for managing electronic mail discussion and e-newsletter lists";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.peti ];
+    description = "Free software for managing electronic mail discussion and newsletter lists";
+    license = stdenv.lib.licenses.gpl3Plus;
+    maintainers = with stdenv.lib.maintainers; [ peti ];
   };
 }