{ config, lib, ... }: let subdomain = "hass"; name = "home-assistant"; in { options.sysconfig.docker.home-assistant.enable = with lib; mkOption { type = with types; bool; default = false; }; config = lib.mkIf (config.sysconfig.docker.home-assistant.enable && config.sysconfig.docker.enable) { environment.etc."home-assistant/configuration.yaml".source = ./configuration.yaml; virtualisation.oci-containers.containers.home-assistant = { image = "ghcr.io/home-assistant/home-assistant:stable"; # unstable, waiting for 26.05 #pull = "newer"; hostname = "${subdomain}.esotericbytes.com"; networks = [ "docker-main" ]; labels = { "traefik.enable" = "true"; "traefik.http.routers.${name}.entrypoints" = "localsecure"; "traefik.http.routers.${name}.rule" = "Host(`${subdomain}.esotericbytes.com`)"; "traefik.http.routers.${name}.service" = "${name}"; "traefik.http.routers.${name}.tls.certResolver" = "cloudflare"; #"traefik.http.services.${name}.loadbalancer.server.url" = "http://192.168.100.10:${builtins.toString hostPort}"; "traefik.http.services.${name}.loadbalancer.server.port" = "8123"; }; environment = { TZ = "America/Chicago"; }; extraOptions = [ "--ip=192.168.101.13" ]; ports = [ ]; volumes = [ "vol_home-assistant:/config/" "/etc/home-assistant/configuration.yaml:/config/configuration.yaml" ]; }; }; }