{ config, lib, ... }: let cfg = config.services.home-assistant; fqdn = "${cfg.subdomain}.${config.networking.domain}"; in { options.services.home-assistant = { subdomain = lib.mkOption { type = lib.types.str; description = "The subdomain to use for Home Assistant"; }; }; config = lib.mkIf cfg.enable { services.webserver = { enable = lib.mkDefault true; vHosts.${fqdn}.locations."/".proxyPort = cfg.config.http.server_port; }; }; }