{ pkgs, config, lib, ... }: let hassConfig = (pkgs.formats.yaml {}).generate "home-assistant-configuration" { config = {}; frontend = {}; history = {}; image = {}; input_boolean = {}; input_datetime = { good_morning = { name = "LED Alarm"; has_time = true; }; }; input_number = {}; input_select = {}; logbook = {}; mobile_app = {}; prometheus = {}; person = {}; ssdp = {}; sun = {}; system_health = {}; updater = {}; zeroconf = {}; zone = {}; http = { use_x_forwarded_for = true; trusted_proxies = config.vpn.hosts.sosiego.vpnIPs; }; group = {}; automation = import ./hass/automations.nix {inherit lib;}; script = {}; scene = {}; }; in { virtualisation.oci-containers.backend = "podman"; virtualisation.oci-containers.containers.home-assistant = { image = "docker.io/homeassistant/home-assistant"; volumes = [ "/var/lib/hass:/config" "/etc/localtime:/etc/localtime:ro" "${hassConfig}:/config/configuration.yaml:ro" ]; extraOptions = ["--net=host" "--pull=always"]; }; systemd.services.podman-home-assistant.serviceConfig.RestartSec = "10s"; # Hack to get podman working with zfs systemd.services.podman-home-assistant.path = [ config.boot.zfs.package ]; }