diff --git a/modules/server/containers/apps/homeassistant.nix b/modules/server/containers/apps/homeassistant.nix index 6d83f94..ec10eba 100644 --- a/modules/server/containers/apps/homeassistant.nix +++ b/modules/server/containers/apps/homeassistant.nix @@ -1,3 +1,43 @@ -{...}:{ - +{ config, containerCfg, pkgs, lib, builder, name, ... }: +let + serverCfg = config.syscfg.server; + image = pkgs.dockerTools.streamLayeredImage { + name = pkgs.home-assistant.name; + tag = pkgs.home-assistant.version; + contents = [ ]; + config = { + Entrypoint = [ "${pkgs.home-assistant}/bin/hass" ]; + ExposedPorts = { + "8123/tcp" = {}; + }; + }; + }; +in { + sops = true; + db = false; + + paths = [{ + path = "${serverCfg.configPath}/homeassistant/"; + mode = "0755"; + }]; + + containers = { + server = builder.mkContainer { + subdomain = containerCfg.subdomain; + imageStream = image; + port = 8123; + secret = name; + extraEnv = { + TZ = config.time.timeZone or "UTC"; + }; + overrides = { + cmd = [ "--config" "/config" ]; + volumes = [ + "${serverCfg.configPath}/homeassistant/:/config" + "/run/dbus:/run/dbus:ro" # Required for Bluetooth/mDNS service discovery + ]; + }; + }; + }; + } \ No newline at end of file