Skip to content

[release-19.09] port new Mailman & Postorius & Hyperkitty NixOS module from master#68500

Merged
peti merged 7 commits intoNixOS:release-19.09from
peti:t/mailman
Sep 14, 2019
Merged

[release-19.09] port new Mailman & Postorius & Hyperkitty NixOS module from master#68500
peti merged 7 commits intoNixOS:release-19.09from
peti:t/mailman

Conversation

@peti
Copy link
Member

@peti peti commented Sep 11, 2019

Merged to master in #67951.

A simple Apache configuration for running Postorious and Hyperkitty looks as follows:

httpd = let webRoot = config.services.mailman.webRoot; in {
  enable = true;
  adminAddr = "postmaster@example.org";
  hostName = "lists.example.org";
  logPerVirtualHost = true;
  extraModules = [ { name = "wsgi"; path = "${pkgs.apacheHttpdPackages.mod_wsgi3}/modules/mod_wsgi.so"; } ];
  extraConfig = ''                                                                                                                                                                                                  
    WSGISocketPrefix /run/httpd/wsgi                                                                                                                                                                                
    WSGIDaemonProcess mailman threads=25 home=/var/lib/mailman-web python-path=${webRoot}:${
      lib.makeSearchPath pkgs.python3.sitePackages
        pkgs.python3Packages.mailman-web.requiredPythonModules
    }                                                                       
  '';
  virtualHosts = [
    { hostName = "lists.example.org";
      documentRoot = config.security.acme.certs."lists.example.org".webroot;
      extraConfig = ''                                                                                                                                                                                              
        <Directory "${config.security.acme.certs."lists.example.org".webroot}">                                                                                                                                     
          Options -Indexes                                                                                                                                                                                          
        </Directory>                                                                                                                                                                                                
        RedirectMatch permanent ^(?!/\.well-known/acme-challenge/).* https://lists.example.org$0                                                                                                                    
                                                                                                                                                                                                                    
      '';
    }
    { hostName = "lists.example.org";
      enableSSL = true;
      sslServerCert = "/var/lib/acme/lists.example.org/fullchain.pem";
      sslServerKey = "/var/lib/acme/lists.example.org/key.pem";
      servedDirs = [ { dir = "/var/lib/mailman-web/static"; urlPath = "/static"; } ];
      extraConfig = ''                                                                                                                                                                                              
        <Directory "${webRoot}">                                                                                                                                                                                    
          <Files wsgi.py>                                                                                                                                                                                           
            Require all granted                                                                                                                                                                                     
          </Files>                                                                                                                                                                                                  
          WSGIProcessGroup mailman                                                                                                                                                                                  
        </Directory>                                                                                                                                                                                                
        WSGIScriptAlias / ${webRoot}/wsgi.py                                                                                                                                                                        
      '';
    }
    { hostName = "localhost";
      servedDirs = [ { dir = "/var/lib/postorius/static"; urlPath = "/static"; } ];
      extraConfig = ''                                                                                                                                                                                              
        <Directory "${webRoot}">                                                                                                                                                                                    
          <Files wsgi.py>                                                                                                                                                                                           
            Require ip 127.0.0.1                                                                                                                                                                                    
            Require all granted                                                                                                                                                                                     
          </Files>                                                                                                                                                                                                  
          WSGIProcessGroup mailman                                                                                                                                                                                  
        </Directory>                                                                                                                                                                                                
        WSGIScriptAlias / ${webRoot}/wsgi.py                                                                                                                                                                        
      '';
    }
  ];
};

…-shift Python library

Suggested in NixOS#67951 (comment).

(cherry picked from commit 86f8895)
When mailman-web restarts, it removes the generated "static" directory. This
breaks a currently running httpd process, which needs a re-start, too, to
obtain a new handle for the newly generated path.

(cherry picked from commit 0cc37b3)
@peti peti requested a review from FRidh as a code owner September 11, 2019 13:43
@peti peti changed the title Port new Mailman & Postorius & Hyperkitty NixOS module from master. [release-19.09] port new Mailman & Postorius & Hyperkitty NixOS module from master Sep 11, 2019
@peti peti added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python Python is a high-level, general-purpose programming language. labels Sep 11, 2019
@peti peti added this to the 19.09 milestone Sep 11, 2019
@ofborg ofborg bot added 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Sep 11, 2019
@peti peti merged commit 4b342f6 into NixOS:release-19.09 Sep 14, 2019
@peti peti deleted the t/mailman branch December 16, 2019 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: python Python is a high-level, general-purpose programming language. 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants