From 2ea7fa983c6acacac8c17519349c419e6ae1b113 Mon Sep 17 00:00:00 2001 From: Romain Paquet Date: Mon, 25 Aug 2025 07:21:21 +0200 Subject: [PATCH] use nix version of home assistant --- machines/genepi/homeassistant.nix | 41 ++++++++++++++++++++++++++----- modules/unbound.nix | 1 + 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/machines/genepi/homeassistant.nix b/machines/genepi/homeassistant.nix index 8506960..313a63e 100644 --- a/machines/genepi/homeassistant.nix +++ b/machines/genepi/homeassistant.nix @@ -1,10 +1,39 @@ +{ config, ... }: +let + domain = "home.rpqt.fr"; + subdomain = "assistant.${domain}"; +in { - virtualisation.oci-containers.containers.homeassistant = { - volumes = [ "home-assistant:/config" ]; - environment.TZ = "Europe/Paris"; - image = "ghcr.io/home-assistant/home-assistant:stable"; - extraOptions = [ - "--network=host" + services.home-assistant = { + enable = true; + extraComponents = [ + # Components required to complete the onboarding + "analytics" + "google_translate" + "met" + "radio_browser" + "shopping_list" + # For fast zlib compression + "isal" ]; + config = { + default_config = { }; + http = { + use_x_forwarded_for = true; + trusted_proxies = [ "127.0.0.1" ]; + }; + }; + }; + + services.nginx.virtualHosts.${subdomain} = { + forceSSL = true; + useACMEHost = "${domain}"; + extraConfig = '' + proxy_buffering off; + ''; + locations."/" = { + proxyPass = "http://127.0.0.1:${toString config.services.home-assistant.config.http.server_port}"; + proxyWebsockets = true; + }; }; } diff --git a/modules/unbound.nix b/modules/unbound.nix index 7ddccf9..cf4796b 100644 --- a/modules/unbound.nix +++ b/modules/unbound.nix @@ -10,6 +10,7 @@ let genepi = { subdomains = [ "actual" + "assistant" "glance" "grafana" "images"