summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/ham/zigbee2mqtt/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-11-18 22:20:24 +0100
committermakefu <github@syntax-fehler.de>2020-11-18 22:20:24 +0100
commite04ae7a3147c731fa3eff16721253cec4dfccdbc (patch)
tree35b4f2acd25bf3e4d2816d89f75c6a65d3989108 /makefu/2configs/ham/zigbee2mqtt/default.nix
parented8f5b65c86ba1b7c796b3214610e0b3f71bc6a7 (diff)
ma ham/zigbee2mqtt: use upstream module
Diffstat (limited to 'makefu/2configs/ham/zigbee2mqtt/default.nix')
-rw-r--r--makefu/2configs/ham/zigbee2mqtt/default.nix30
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" ];
}