summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/ham/zigbee2mqtt/default.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2020-11-23 11:33:23 +0100
committerlassulus <lassulus@lassul.us>2020-11-23 11:33:23 +0100
commit1b4d1c4aaba003f42a542ce1cf442a4983f50194 (patch)
treeef6e88ffcd5f036fa31086e119fa25b7a4c98874 /makefu/2configs/ham/zigbee2mqtt/default.nix
parent801ea60c3a31db7600d004697d4520b636f3c0df (diff)
parentb26b6c4ccedfc6f92193dd7386e382d0bf88a293 (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.nix31
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" ];
}