summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham/zigbee2mqtt/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-03-09 22:14:51 +0100
committermakefu <github@syntax-fehler.de>2021-03-09 22:14:51 +0100
commitce2aadff1c8d1d44a51c3be27570c64e14fd13c1 (patch)
tree42ea3346ff62034aae8014e00d7f475f51276e6e /makefu/2configs/home/ham/zigbee2mqtt/default.nix
parent914163cec3b89e2abcbc58e535e648ac9788b305 (diff)
ma ham -> ma home/ham
Diffstat (limited to 'makefu/2configs/home/ham/zigbee2mqtt/default.nix')
-rw-r--r--makefu/2configs/home/ham/zigbee2mqtt/default.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/makefu/2configs/home/ham/zigbee2mqtt/default.nix b/makefu/2configs/home/ham/zigbee2mqtt/default.nix
new file mode 100644
index 000000000..a75075273
--- /dev/null
+++ b/makefu/2configs/home/ham/zigbee2mqtt/default.nix
@@ -0,0 +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="dialout"
+ '';
+
+ services.zigbee2mqtt = {
+ enable = true;
+ inherit dataDir;
+ };
+
+ state = [ "${dataDir}/configuration.yaml" "${dataDir}/state.json" ];
+
+ 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"
+ ];
+ };
+}