2020-02-24 15:59:11 +00:00
|
|
|
{config, pkgs, lib, ...}:
|
|
|
|
|
2020-11-18 21:20:24 +00:00
|
|
|
let
|
|
|
|
dataDir = "/var/lib/zigbee2mqtt";
|
|
|
|
in
|
|
|
|
{
|
2020-03-03 20:17:43 +00:00
|
|
|
# symlink the zigbee controller
|
2020-02-24 15:59:11 +00:00
|
|
|
services.udev.extraRules = ''
|
2020-11-18 21:20:24 +00:00
|
|
|
SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
|
2020-02-24 15:59:11 +00:00
|
|
|
'';
|
2020-03-03 20:17:43 +00:00
|
|
|
|
2020-11-18 21:20:24 +00:00
|
|
|
services.zigbee2mqtt = {
|
|
|
|
enable = true;
|
|
|
|
inherit dataDir;
|
|
|
|
};
|
|
|
|
|
|
|
|
state = [ "${dataDir}/configuration.yaml" "${dataDir}/state.json" ];
|
2020-03-03 20:17:43 +00:00
|
|
|
|
2020-11-18 21:20:24 +00:00
|
|
|
systemd.services.zigbee2mqtt = {
|
2020-11-18 21:26:41 +00:00
|
|
|
# override automatic configuration.yaml deployment
|
2020-11-18 21:20:24 +00:00
|
|
|
serviceConfig.ExecStartPre = lib.mkForce "${pkgs.coreutils}/bin/true";
|
|
|
|
after = [
|
|
|
|
"home-assistant.service"
|
|
|
|
"mosquitto.service"
|
|
|
|
"network-online.target"
|
|
|
|
];
|
2020-03-03 20:17:43 +00:00
|
|
|
};
|
2020-02-24 15:59:11 +00:00
|
|
|
}
|