From d925c68f582428b90f015df197dbe6ccf16f7dba Mon Sep 17 00:00:00 2001 From: magic_rb Date: Mon, 22 Jan 2024 00:44:17 +0100 Subject: [PATCH] Add service to deploy home-assistant pyscript scripts Signed-off-by: magic_rb --- nixos/systems/blowhole/default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nixos/systems/blowhole/default.nix b/nixos/systems/blowhole/default.nix index 1d69fa4..81cb5fc 100644 --- a/nixos/systems/blowhole/default.nix +++ b/nixos/systems/blowhole/default.nix @@ -109,6 +109,20 @@ in system.stateVersion = "21.05"; + systemd.services.home-assistant-pyscript = { + wantedBy = ["multi-user.target"]; + restartIfChanged = true; + path = [ pkgs.rsync ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = "yes"; + }; + script = '' + mkdir -p /mnt/kyle/infrastructure/home-assistant/home-assistant/pyscript + rsync --chown 403:403 --chmod Du=rwx,Dgo=rx,Fu=rw,Fgo=r -arvc --delete ${secret.pyscript}/. /mnt/kyle/infrastructure/home-assistant/home-assistant/pyscript/ + ''; + }; + boot.kernel.sysctl."fs.inotify.max_user_instances" = 256; services.udev.extraRules = let