This commit is contained in:
Vivian 2024-10-31 15:39:24 +01:00
parent 448b9e7439
commit c5bc2e1a19
8 changed files with 221 additions and 184 deletions

View file

@ -3,8 +3,10 @@
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
let mosquittoPort = 1883;
in {
let
mosquittoPort = 1883;
in
{
imports = [ ];
# This value determines the NixOS release from which the default
@ -20,15 +22,21 @@ in {
services.mosquitto = {
enable = true;
listeners = [{
port = mosquittoPort;
settings.allow_anonymous = true;
acl = [ "topic readwrite #" ];
users = {
vivian = { acl = [ "readwrite #" ]; };
zigbee2mqtt = { acl = [ "readwrite #" ]; };
};
}];
listeners = [
{
port = mosquittoPort;
settings.allow_anonymous = true;
acl = [ "topic readwrite #" ];
users = {
vivian = {
acl = [ "readwrite #" ];
};
zigbee2mqtt = {
acl = [ "readwrite #" ];
};
};
}
];
};
@ -39,7 +47,9 @@ in {
homeassistant = true;
permit_join = false;
serial = { port = "/dev/ttyUSB0"; };
serial = {
port = "/dev/ttyUSB0";
};
mqtt = {
base_topic = "zigbee2mqtt";
@ -47,10 +57,14 @@ in {
user = "zigbee2mqtt";
};
frontend = { port = 8080; };
frontend = {
port = 8080;
};
};
};
networking.firewall.allowedTCPPorts =
[ mosquittoPort config.services.zigbee2mqtt.settings.frontend.port ];
networking.firewall.allowedTCPPorts = [
mosquittoPort
config.services.zigbee2mqtt.settings.frontend.port
];
}