dotfiles/modules/nixos/services/mosquitto/default.nix

49 lines
1.1 KiB
Nix
Raw Normal View History

2023-11-27 02:41:45 +00:00
{
options,
config,
lib,
pkgs,
format,
...
}:
with lib; let
cfg = config.aa.services.mosquitto;
mosquitto_cfg = config.services.mosquitto;
in {
options.aa.services.mosquitto = with types; {
enable = mkEnableOption "home assistant";
};
config = mkIf cfg.enable {
age.secrets = {
hass_mqtt.file = ../../../../secrets/hass_mqtt.age;
theengs_ble_mqtt.file = ../../../../secrets/theengs_ble_mqtt.age;
};
services.mosquitto = {
enable = true;
listeners = [
{
users = {
hass = {
acl = [
2023-12-01 04:05:14 +00:00
"readwrite home/#"
"readwrite homeassistant/#"
2023-11-27 02:41:45 +00:00
];
passwordFile = config.age.secrets.hass_mqtt.path;
};
theengs_ble_gateway = {
2023-12-01 04:05:14 +00:00
acl = [
"readwrite home/#"
"readwrite homeassistant/#"
];
2023-11-27 02:41:45 +00:00
passwordFile = config.age.secrets.theengs_ble_mqtt.path;
};
};
}
];
};
networking.firewall.allowedTCPPorts = [1883];
};
}