{ config, lib, ... }: let hostPort = 9003; 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) { networking.firewall.interfaces = { "ve-traefik" = { allowedTCPPorts = [ hostPort ]; }; }; virtualisation.oci-containers.containers.home-assistant = { image = "home-assistant/home-assistant:stable"; # unstable, waiting for 26.05 #pull = "newer"; hostname = "${subdomain}.esotericbytes.com"; networks = [ "docker-main" ]; labels = { "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}"; }; extraOptions = [ "--ip=192.168.101.6" ]; environment = { TZ = "America/Chicago"; }; ports = [ "${builtins.toString hostPort}:8123" ]; volumes = [ "vol_home-assistant:/config/" ]; }; }; }