feat: add ESPHome dashboard

This commit is contained in:
Felix Schröter 2022-12-29 14:13:40 +01:00
parent ac478e222e
commit 5f6553e5bc
Signed by: felschr
GPG key ID: 671E39E6744C807D
2 changed files with 34 additions and 0 deletions

View file

@ -24,6 +24,7 @@ in with builtins; {
./services/mosquitto.nix
./services/genie.nix
./services/home-assistant.nix
./services/esphome.nix
./services/watchtower.nix
./services/owntracks.nix
./services/immich.nix
@ -82,6 +83,7 @@ in with builtins; {
passwordFile = config.age.secrets.cloudflare.path;
domains = [
"home.felschr.com"
"esphome.felschr.com"
"cloud.felschr.com"
"office.felschr.com"
"media.felschr.com"

32
services/esphome.nix Normal file
View file

@ -0,0 +1,32 @@
{ config, pkgs, ... }:
with pkgs;
let
port = 6052;
inherit (config.services.home-assistant) configDir;
in {
services.nginx = {
virtualHosts."esphome.felschr.com" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://[::1]:${toString port}";
proxyWebsockets = true;
};
};
};
systemd.services.esphome = {
description = "ESPHome";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "hass";
Group = "hass";
Restart = "on-failure";
WorkingDirectory = configDir;
ExecStart = "${pkgs.esphome}/bin/esphome dashboard ${configDir}/esphome";
};
};
}