NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.11k stars 14.15k forks source link

Mailman service complains about webHosts even when serve.enable = false #214897

Open sephii opened 1 year ago

sephii commented 1 year ago

Describe the bug

The mailman service, enabled with services.mailman.enable = true, throws an assertion error when services.mailman.serve.enable = false and services.mailman.webHosts = [].

Steps To Reproduce

Steps to reproduce the behavior:

  1. Enable mailman with services.mailman.enable = true and services.mailman.serve.enable = false
  2. Try to build the configuration
  3. Get a failed assertion "services.mailman.serve.enable requires there to be at least one entry in services.mailman.webHosts"

Expected behavior

No failed assertion about services.mailman.webHosts being empty if services.mailman.serve.enable = false.

I think the following assertion:

{ assertion = cfg.webHosts != [];
  message = ''
    services.mailman.serve.enable requires there to be at least one entry
    in services.mailman.webHosts.
  '';
}

should be wrapped in a lib.optionals cfg.serve.enable.

Notify maintainers

@lheckemann @Ma27

Ma27 commented 1 year ago

Feel free to file a patch for this :)