diff --git a/systems/zaatar/home-assistant.nix b/systems/zaatar/home-assistant.nix index 74879f1..980125d 100644 --- a/systems/zaatar/home-assistant.nix +++ b/systems/zaatar/home-assistant.nix @@ -74,6 +74,40 @@ in { hardware.bluetooth.enable = true; + systemd.services.update-containers = { + startAt = "Mon 02:00"; + script = '' + images=$(${pkgs.podman}/bin/podman ps -a --format="{{.Image}}" | sort -u) + + for image in $images; do + ${pkgs.podman}/bin/podman pull "$image" + done + ''; + serviceConfig = { + Type = "oneshot"; + Restart = "on-failure"; + RestartSec = "1h"; + }; + }; + + systemd.services.restart-homeassistant = { + startAt = "Tue 02:00"; + script = '' + ${pkgs.systemd}/bin/systemctl try-restart podman-homeassistant.service + ''; + serviceConfig = { + Type = "oneshot"; + }; + }; + + virtualisation.podman = { + enable = true; + autoPrune = { + enable = true; + flags = ["--all"]; + }; + }; + virtualisation.oci-containers = { backend = "podman"; containers.homeassistant = {