summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/ham/zigbee2mqtt/default.nix
blob: 36d332d4239f60902b1c53cf7c0caeeff0016362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{config, pkgs, lib, ...}:

let
  dataDir = "/var/lib/zigbee2mqtt";
in
  {
  # symlink the zigbee controller
  services.udev.extraRules = ''
    SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
  '';

  services.zigbee2mqtt = {
    enable = true;
    inherit dataDir;
  };

  state = [ "${dataDir}/configuration.yaml" "${dataDir}/state.json" ];

  systemd.services.zigbee2mqtt = {
    serviceConfig.ExecStartPre = lib.mkForce "${pkgs.coreutils}/bin/true";
    after = [
      "home-assistant.service"
      "mosquitto.service"
      "network-online.target"
    ];
  };
}