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 <noreply@anthropic.com>
This commit is contained in:
ltadeu6 2026-05-17 16:46:28 -03:00
parent 3ac9b2c518
commit 4ab92a985a
No known key found for this signature in database
GPG key ID: FB9FDAB6B6F3418D

View file

@ -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" ];