Merge pull request #167322 from alyssais/mailman-webHosts

nixos/mailman: improve empty webHosts error
This commit is contained in:
Linus Heckemann 2022-04-09 20:15:33 +02:00 committed by GitHub
commit 918a149888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -225,7 +225,14 @@ in {
See <https://mailman.readthedocs.io/en/latest/src/mailman/docs/mta.html>.
'';
};
in (lib.optionals cfg.enablePostfix [
in [
{ assertion = cfg.webHosts != [];
message = ''
services.mailman.serve.enable requires there to be at least one entry
in services.mailman.webHosts.
'';
}
] ++ (lib.optionals cfg.enablePostfix [
{ assertion = postfix.enable;
message = ''
Mailman's default NixOS configuration requires Postfix to be enabled.
@ -275,7 +282,7 @@ in {
globals().update(json.load(f))
'';
services.nginx = mkIf cfg.serve.enable {
services.nginx = mkIf (cfg.serve.enable && cfg.webHosts != []) {
enable = mkDefault true;
virtualHosts = lib.genAttrs cfg.webHosts (webHost: {
locations = {