Added mosquitto as mqtt broker
This commit is contained in:
parent
9f33922eec
commit
b309200640
8 changed files with 71 additions and 13 deletions
|
@ -33,6 +33,8 @@ in {
|
|||
extraComponents = [
|
||||
"hue"
|
||||
"met"
|
||||
"mqtt"
|
||||
"octoprint"
|
||||
"tuya"
|
||||
"vizio"
|
||||
"zeroconf"
|
||||
|
|
45
modules/nixos/services/mosquitto/default.nix
Normal file
45
modules/nixos/services/mosquitto/default.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
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 = [
|
||||
"read home/#"
|
||||
"readwrite homeassistant/status"
|
||||
];
|
||||
passwordFile = config.age.secrets.hass_mqtt.path;
|
||||
};
|
||||
theengs_ble_gateway = {
|
||||
acl = ["readwrite home/#"];
|
||||
passwordFile = config.age.secrets.theengs_ble_mqtt.path;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [1883];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue