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.nix108
1 files changed, 23 insertions, 85 deletions
diff --git a/pkgs/servers/mail/mailman/default.nix b/pkgs/servers/mail/mailman/default.nix
index f5632df7949..50742c0abc0 100644
--- a/pkgs/servers/mail/mailman/default.nix
+++ b/pkgs/servers/mail/mailman/default.nix
@@ -1,95 +1,33 @@
-{ lib, buildPythonPackage, fetchPypi, fetchpatch, pythonOlder, python3, postfix, lynx
-}:
+{ newScope, lib, python3 }:
 
 let
-  # Mailman does not support sqlalchemy >= 1.4 https://gitlab.com/mailman/mailman/-/issues/845
-  pythonOverride = python3.override {
-    packageOverrides = self: super: {
-      alembic = super.alembic.overridePythonAttrs (oldAttrs:  {
-        # does not find tests
-        doCheck = false;
-      });
-      sqlalchemy = super.sqlalchemy.overridePythonAttrs (oldAttrs: rec {
-        version = "1.3.24";
-        src = oldAttrs.src.override {
-          inherit version;
-          hash = "sha256-67t3fL+TEjWbiXv4G6ANrg9ctp+6KhgmXcwYpvXvdRk=";
-        };
-        # does not find tests
-        doCheck = false;
-      });
-    };
-  };
-in
+  callPackage = newScope self;
 
-buildPythonPackage rec {
-  pname = "mailman";
-  version = "3.3.5";
-  disabled = pythonOlder "3.6";
+  self = lib.makeExtensible (self: {
+    python3 = callPackage ./python.nix { inherit python3; };
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "12mgxs1ndhdjjkydx48b95na9k9h0disfqgrr6wxx7vda6dqvcwz";
-  };
+    hyperkitty = callPackage ./hyperkitty.nix { };
 
-  propagatedBuildInputs = with pythonOverride.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
-  ];
+    mailman = callPackage ./package.nix { };
 
-  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
-  ];
+    mailman-hyperkitty = callPackage ./mailman-hyperkitty.nix { };
 
-  postPatch = ''
-    substituteInPlace setup.py \
-      --replace "alembic>=1.6.2,<1.7" "alembic>=1.6.2"
+    postorius = callPackage ./postorius.nix { };
 
-    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
-  '';
+    web = callPackage ./web.nix { };
 
-  # 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;
+    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 ]);
+      };
+  });
 
-  # 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 ];
-  };
-}
+in self