diff options
author | tv <tv@krebsco.de> | 2020-12-02 00:45:50 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2020-12-02 00:45:50 +0100 |
commit | d60b1b793f3a1635c1fe30aa11b64831fd665b4f (patch) | |
tree | d484b1315dab9b6c3d230118f6e33b0888f0aca5 /makefu/2configs/ham/zigbee2mqtt/default.nix | |
parent | 29827720520b6a4885dbdcb3237070e6e45dd910 (diff) | |
parent | 813eefa3c55fd1cd234b0adb1da7286bd761b579 (diff) |
Merge remote-tracking branch 'prism/master' into master
Diffstat (limited to 'makefu/2configs/ham/zigbee2mqtt/default.nix')
-rw-r--r-- | makefu/2configs/ham/zigbee2mqtt/default.nix | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/makefu/2configs/ham/zigbee2mqtt/default.nix b/makefu/2configs/ham/zigbee2mqtt/default.nix index 84d32c872..a75075273 100644 --- a/makefu/2configs/ham/zigbee2mqtt/default.nix +++ b/makefu/2configs/ham/zigbee2mqtt/default.nix @@ -1,21 +1,28 @@ {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 = { + # override automatic configuration.yaml deployment + 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" ]; } |