@ -38,7 +38,7 @@ let
webSettingsJSON = pkgs . writeText " s e t t i n g s . j s o n " ( builtins . toJSON webSettings ) ;
# TODO: Should this be RFC42-ised so that users can set additional options without modifying the module?
m taConfig = pkgs . writeText " m a i l m a n - p o s t f i x . c f g " ''
postfixM taConfig = pkgs . writeText " m a i l m a n - p o s t f i x . c f g " ''
[ postfix ]
postmap_command : $ { pkgs . postfix } /bin/postmap
transport_file_type : hash
@ -81,7 +81,7 @@ in {
enable = mkOption {
type = types . bool ;
default = false ;
description = " E n a b l e M a i l m a n o n t h i s h o s t . R e q u i r e s a n a c t i v e P o s t f i x i n s t a l l a t i o n . " ;
description = " E n a b l e M a i l m a n o n t h i s h o s t . R e q u i r e s a n a c t i v e M T A o n t h e h o s t ( e . g . P o s t f i x ) . " ;
} ;
package = mkOption {
@ -92,6 +92,20 @@ in {
description = " M a i l m a n p a c k a g e t o u s e " ;
} ;
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 .
'' ;
} ;
siteOwner = mkOption {
type = types . str ;
example = " p o s t m a s t e r @ e x a m p l e . o r g " ;
@ -182,7 +196,7 @@ in {
pid_file = " / r u n / m a i l m a n / m a s t e r . p i d " ;
} ;
mta . configuration = lib . mkDefault "${ m taConfig} " ;
mta . configuration = lib . mkDefault ( if cfg . enablePostfix then "${ postfixM taConfig} " else throw " W h e n M a i l m a n P o s t f i x i n t e g r a t i o n i s d i s a b l e d , s e t ` s e r v i c e s . m a i l m a n . s e t t i n g s . m t a . c o n f i g u r a t i o n ` t o t h e p a t h o f t h e c o n f i g f i l e r e q u i r e d t o i n t e g r a t e w i t h y o u r M T A . " ) ;
" a r c h i v e r . h y p e r k i t t y " = lib . mkIf cfg . hyperkitty . enable {
class = " m a i l m a n _ h y p e r k i t t y . A r c h i v e r " ;
@ -211,14 +225,22 @@ in {
See < https://mailman.readthedocs.io/en/latest/src/mailman/docs/mta.html > .
'' ;
} ;
in [
in ( lib . optionals cfg . enablePostfix [
{ assertion = postfix . enable ;
message = " M a i l m a n r e q u i r e s P o s t f i x " ;
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 .
'' ;
}
( requirePostfixHash [ " r e l a y D o m a i n s " ] " p o s t f i x _ d o m a i n s " )
( requirePostfixHash [ " c o n f i g " " t r a n s p o r t _ m a p s " ] " p o s t f i x _ l m t p " )
( requirePostfixHash [ " c o n f i g " " l o c a l _ r e c i p i e n t _ m a p s " ] " p o s t f i x _ l m t p " )
] ;
] ) ;
users . users . mailman = {
description = " G N U M a i l m a n " ;
@ -275,7 +297,7 @@ in {
'' ;
} ) ] ;
services . postfix = {
services . postfix = lib . mkIf cfg . enablePostfix {
recipientDelimiter = " + " ; # bake recipient addresses in mail envelopes via VERP
config = {
owner_request_special = " n o " ; # Mailman handles -owner addresses on its own