Change:
Describe the bug Mailman module in NixOS requires postfix enabled and has no way to configure Mailman to work with other MTAs supported by both NixOS and mailman upstream. To Reproduce Steps to reproduce the behavior: postfix mailman the evaluation with an assertion Expected behavior The Mailman module allows to select an MTA of choice (or even adapts to the currently enabled MTA) Screenshots n/a Additional context Notify maintainers cc Metadata system: host os: multi-user?: sandbox: version: channels(root): channels(vika): nixpkgs: Maintainer information:
It looks like exim's configuration should be RFC42-ised first if we want to inject Mailman-related settings into Exim config, which is a requirement (Mailman requires a custom Exim router and transport).
Yes, the module is currently quite opinionated. If you're willing to contribute exim support that's great.
I see how I could make it work, but the first version of it will require manual editing of Exim's config files (because RFC42-ising Exim will be a pain, even though I have some drafts on how to translate Nix into the syntax that's required), and I'm not sure if it will be merge-worthy enough :3
Exim config is complicated enough as is, I'm not sure adding an intermediate layer from nix will help that much. I also don't really see this integrating well with existing or other exim config. I'm honestly kind of surprised this works for postfix.

Discussion:
<itemizedlist> <listitem> <para> <ins> The Mailman NixOS module (<literal>services.mailman</literal>) has a new option <xref linkend="opt-services.mailman.enablePostfix" />, defaulting to true, that controls integration with Postfix. </para> <para> If this option is disabled, default MTA config becomes not set and you should set the options in <literal>services.mailman.settings.mta</literal> according to the desired configuration as described in <link xlink:href="https://mailman.readthedocs.io/en/latest/src/mailman/docs/mta.html">Mailman documentation</link>. </para> </listitem> <listitem> <para> </ins> The default-version of <literal>nextcloud</literal> is <package>nextcloud20</package>. Please note that it's <emphasis>not</emphasis> possible to upgrade <literal>nextcloud</literal> across multiple major versions! This means that it's e.g. not possible to upgrade

webSettingsJSON = pkgs.writeText "settings.json" (builtins.toJSON webSettings); # TODO: Should this be RFC42-ised so that users can set additional options without modifying the module? <del> mtaConfig = pkgs.writeText "mailman-postfix.cfg" '' </del> <ins> postfixMtaConfig = pkgs.writeText "mailman-postfix.cfg" '' </ins> [postfix] postmap_command: ${pkgs.postfix}/bin/postmap transport_file_type: hash

enable = mkOption { type = types.bool; default = false; <del> description = "Enable Mailman on this host. Requires an active Postfix installation."; </del> <ins> description = "Enable Mailman on this host. Requires an active MTA on the host (e.g. Postfix)."; </ins> }; package = mkOption {

description = "Mailman package to use"; }; <ins> enablePostfix = mkOption { type = types.bool; default = true; example = false; description = '' Enable Postfix integration. Requires an active Postfix installation. If you want to use another MTA, set this option to false and configure settings in services.mailman.settings.mta. Refer to the Mailman manual for more info. ''; }; </ins> siteOwner = mkOption { type = types.str; example = "postmaster@example.org";

pid_file = "/run/mailman/master.pid"; }; <del> mta.configuration = lib.mkDefault "${mtaConfig}"; </del> <ins> mta.configuration = lib.mkDefault (if cfg.enablePostfix then "${postfixMtaConfig}" else throw "When Mailman Postfix integration is disabled, set `services.mailman.settings.mta.configuration` to the path of the config file required to integrate with your MTA."); </ins> "archiver.hyperkitty" = lib.mkIf cfg.hyperkitty.enable { class = "mailman_hyperkitty.Archiver";

See <https://mailman.readthedocs.io/en/latest/src/mailman/docs/mta.html>. ''; }; <del> in [ </del> <ins> in (lib.optionals cfg.enablePostfix [ </ins> { assertion = postfix.enable; <del> message = "Mailman requires Postfix"; </del> <ins> message = '' Mailman's default NixOS configuration requires Postfix to be enabled. If you want to use another MTA, set services.mailman.enablePostfix to false and configure settings in services.mailman.settings.mta. Refer to <https://mailman.readthedocs.io/en/latest/src/mailman/docs/mta.html> for more info. ''; </ins> } (requirePostfixHash [ "relayDomains" ] "postfix_domains") (requirePostfixHash [ "config" "transport_maps" ] "postfix_lmtp") (requirePostfixHash [ "config" "local_recipient_maps" ] "postfix_lmtp") <del> ]; </del> <ins> ]); </ins> users.users.mailman = { description = "GNU Mailman";

''; }) ]; <del> services.postfix = { </del> <ins> services.postfix = lib.mkIf cfg.enablePostfix { </ins> recipientDelimiter = "+";         # bake recipient addresses in mail envelopes via VERP config = { owner_request_special = "no";   # Mailman handles -owner addresses on its own

</para> <section xml:id="module-services-mailman-basic-usage"> <del> <title>Basic usage</title> </del> <ins> <title>Basic usage with Postfix</title> </ins> <para> <del> For a basic configuration, the following settings are suggested: </del> <ins> For a basic configuration with Postfix as the MTA, the following settings are suggested: </ins> <programlisting>{ config, ... }: { services.postfix = { enable = true;

necessary, but outside the scope of the Mailman module. </para> </section> <ins> <section xml:id="module-services-mailman-other-mtas"> <title>Using with other MTAs</title> <para> Mailman also supports other MTA, though with a little bit more configuration. For example, to use Mailman with Exim, you can use the following settings: <programlisting>{ config, ... }: { services = { mailman = { enable = true; siteOwner = "mailman@example.org"; <link linkend="opt-services.mailman.enablePostfix">enablePostfix</link> = false; settings.mta = { incoming = "mailman.mta.exim4.LMTP"; outgoing = "mailman.mta.deliver.deliver"; lmtp_host = "localhost"; lmtp_port = "8024"; smtp_host = "localhost"; smtp_port = "25"; configuration = "python:mailman.config.exim4"; }; }; exim = { enable = true; # You can configure Exim in a separate file to reduce configuration.nix clutter config = builtins.readFile ./exim.conf; }; }; }</programlisting> </para> <para> The exim config needs some special additions to work with Mailman. Currently NixOS can't manage Exim config with such granularity. Please refer to <link xlink:href="https://mailman.readthedocs.io/en/latest/src/mailman/docs/mta.html">Mailman documentation</link> for more info on configuring Mailman for working with Exim. </para> </section> </ins> </chapter>