2022-12-29 14:13:40 +01:00
|
|
|
{ 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."/" = {
|
2022-12-29 14:22:30 +01:00
|
|
|
proxyPass = "http://localhost:${toString port}";
|
2022-12-29 14:13:40 +01:00
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|