22 lines
370 B
Nix
22 lines
370 B
Nix
|
{
|
||
|
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;}];
|
||
|
};
|
||
|
};
|
||
|
}
|