diff options
author | lassulus <lassulus@lassul.us> | 2020-11-23 11:33:23 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2020-11-23 11:33:23 +0100 |
commit | 1b4d1c4aaba003f42a542ce1cf442a4983f50194 (patch) | |
tree | ef6e88ffcd5f036fa31086e119fa25b7a4c98874 /makefu/2configs/ham/zigbee2mqtt/default.nix | |
parent | 801ea60c3a31db7600d004697d4520b636f3c0df (diff) | |
parent | b26b6c4ccedfc6f92193dd7386e382d0bf88a293 (diff) |
Merge remote-tracking branch 'gum/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" ]; } |