From 92ea9147823b3402b75076b87b731c9d7f6869cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 16 Feb 2025 15:45:20 +0100 Subject: [PATCH] nixos/zigbee2mqtt: set StateDirectory So that the directory is guaranteed to exist at service startup. This fixes the scenario where the service is stopped, the state directory removed and the service started again (for testing / starting fresh). Set StateDirectoryMode to match the existing directory permissions. --- nixos/modules/services/home-automation/zigbee2mqtt.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/modules/services/home-automation/zigbee2mqtt.nix b/nixos/modules/services/home-automation/zigbee2mqtt.nix index c76c1c86da75..42c3214ef4f3 100644 --- a/nixos/modules/services/home-automation/zigbee2mqtt.nix +++ b/nixos/modules/services/home-automation/zigbee2mqtt.nix @@ -83,6 +83,8 @@ in User = "zigbee2mqtt"; Group = "zigbee2mqtt"; WorkingDirectory = cfg.dataDir; + StateDirectory = "zigbee2mqtt"; + StateDirectoryMode = "0700"; Restart = "on-failure"; # Hardening