{ lib, config, pkgs, ... }: with lib; let haCfg = config.pub-solar.home-assistant; cfg = config.pub-solar.home-assistant.mqtt; in { config = mkIf (haCfg.enable && cfg.enable) { networking.firewall.allowedTCPPorts = [ 1883 # mosquitto ]; services.mosquitto = { enable = true; listeners = [{users = cfg.users;}]; }; }; }