diff options
Diffstat (limited to 'makefu/2configs/ham/zigbee2mqtt/default.nix')
-rw-r--r-- | makefu/2configs/ham/zigbee2mqtt/default.nix | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/makefu/2configs/ham/zigbee2mqtt/default.nix b/makefu/2configs/ham/zigbee2mqtt/default.nix index 84d32c872..36d332d42 100644 --- a/makefu/2configs/ham/zigbee2mqtt/default.nix +++ b/makefu/2configs/ham/zigbee2mqtt/default.nix @@ -1,21 +1,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="dailout" + SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout" ''; - system.activationScripts.installZigbee = '' - install -d /var/lib/zigbee2mqtt - ''; + services.zigbee2mqtt = { + enable = true; + inherit dataDir; + }; + + state = [ "${dataDir}/configuration.yaml" "${dataDir}/state.json" ]; - docker-containers.zigbee2mqtt = { - image = "koenkk/zigbee2mqtt"; - extraDockerOptions = [ "--device=/dev/cc2531:/dev/cc2531" ]; - volumes = ["/var/lib/zigbee2mqtt:/app/data"]; + systemd.services.zigbee2mqtt = { + serviceConfig.ExecStartPre = lib.mkForce "${pkgs.coreutils}/bin/true"; + after = [ + "home-assistant.service" + "mosquitto.service" + "network-online.target" + ]; }; - state = [ "/var/lib/zigbee2mqtt/configuration.yaml" "/var/lib/zigbee2mqtt/state.json" ]; - systemd.services.docker-zigbee2mqtt.after = [ "home-assistant.service" "docker.service" "network-online.target" ]; } |