1{
2 lib,
3 fetchpatch,
4 python3,
5 fetchPypi,
6 postfix,
7 lynx,
8 nixosTests,
9}:
10
11with python3.pkgs;
12
13buildPythonPackage rec {
14 pname = "mailman";
15 version = "3.3.9";
16 pyproject = true;
17
18 disabled = pythonOlder "3.6";
19
20 src = fetchPypi {
21 inherit pname version;
22 hash = "sha256-GblXI6IwkLl+V1gEbMAe1baVyZOHMaYaYITXcTkp2Mo=";
23 };
24
25 build-system = with python3.pkgs; [
26 setuptools
27 ];
28
29 dependencies = with python3.pkgs; [
30 aiosmtpd
31 alembic
32 authheaders
33 click
34 dnspython
35 falcon
36 flufl-bounce
37 flufl-i18n
38 flufl-lock
39 gunicorn
40 lazr-config
41 passlib
42 python-dateutil
43 requests
44 sqlalchemy
45 standard-nntplib
46 zope-component
47 zope-configuration
48 ];
49
50 checkInputs = [
51 sphinx
52 ];
53
54 patches = [
55 (fetchpatch {
56 url = "https://gitlab.com/mailman/mailman/-/commit/4b206e2a5267a0e17f345fd7b2d957122ba57566.patch";
57 sha256 = "06axmrn74p81wvcki36c7gfj5fp5q15zxz2yl3lrvijic7hbs4n2";
58 })
59 (fetchpatch {
60 url = "https://gitlab.com/mailman/mailman/-/commit/9613154f3c04fa2383fbf017031ef263c291418d.patch";
61 sha256 = "0vyw87s857vfxbf7kihwb6w094xyxmxbi1bpdqi3ybjamjycp55r";
62 })
63 (fetchpatch {
64 name = "python-3.13.patch";
65 url = "https://gitlab.com/mailman/mailman/-/commit/685d9a7bdbd382d9e8d4a2da74bd973e93356e05.patch";
66 hash = "sha256-KCXVP+5zqgluUXQCGmMRC+G1hEDnFBlTUETGpmFDOOk=";
67 })
68 ./log-stderr.patch
69 ];
70
71 postPatch = ''
72 substituteInPlace src/mailman/config/postfix.cfg \
73 --replace /usr/sbin/postmap ${postfix}/bin/postmap
74 substituteInPlace src/mailman/config/schema.cfg \
75 --replace /usr/bin/lynx ${lynx}/bin/lynx
76 '';
77
78 # Mailman assumes that those scripts in $out/bin are Python scripts. Wrapping
79 # them in shell code breaks this assumption. Use the wrapped version (see
80 # wrapped.nix) if you need the CLI (rather than the Python library).
81 #
82 # This gives a properly wrapped 'mailman' command plus an interpreter that
83 # has all the necessary search paths to execute unwrapped 'master' and
84 # 'runner' scripts.
85 dontWrapPythonPrograms = true;
86
87 passthru.tests = { inherit (nixosTests) mailman; };
88
89 meta = {
90 homepage = "https://www.gnu.org/software/mailman/";
91 description = "Free software for managing electronic mail discussion and newsletter lists";
92 license = lib.licenses.gpl3Plus;
93 maintainers = with lib.maintainers; [ qyliss ];
94 };
95}