From 4ab92a985ae4f6cf6fba714fdde3cdbf70517332 Mon Sep 17 00:00:00 2001 From: ltadeu6 Date: Sun, 17 May 2026 16:46:28 -0300 Subject: [PATCH] Fix LocalTuya install: use systemd service instead of tmpfiles systemd-tmpfiles L+ was not creating the symlink. Replace with a oneshot service that copies the component before HA starts. Co-Authored-By: Claude Sonnet 4.6 --- hosts/Nixos/configuration.nix | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/hosts/Nixos/configuration.nix b/hosts/Nixos/configuration.nix index 2859f11..c4d6103 100644 --- a/hosts/Nixos/configuration.nix +++ b/hosts/Nixos/configuration.nix @@ -1281,9 +1281,22 @@ in { }; }; - systemd.tmpfiles.rules = [ - "L+ /var/lib/hass/custom_components/localtuya - hass hass - ${../../configs/home-assistant/custom_components/localtuya}" - ]; + systemd.services.hass-localtuya-install = { + description = "Install LocalTuya custom component for Home Assistant"; + before = [ "home-assistant.service" ]; + wantedBy = [ "home-assistant.service" ]; + serviceConfig = { + Type = "oneshot"; + User = "hass"; + RemainAfterExit = true; + }; + script = '' + mkdir -p /var/lib/hass/custom_components + rm -rf /var/lib/hass/custom_components/localtuya + cp -r ${../../configs/home-assistant/custom_components/localtuya} /var/lib/hass/custom_components/localtuya + chmod -R u+rw /var/lib/hass/custom_components/localtuya + ''; + }; systemd.timers."nix-flake-update" = { wantedBy = [ "timers.target" ];