Files
nix-config/modules/nixos/homeassistant/services/esphome/default.nix
2026-04-10 09:48:58 -05:00

37 lines
846 B
Nix
Executable File

{
config,
lib,
namespace,
...
}:
with lib;
let
cfg = config.${namespace}.services.home-assistant;
in
{
config = mkIf cfg.enable {
virtualisation.oci-containers.containers.esphome = {
autoStart = true;
image = "ghcr.io/esphome/esphome:2026.2.4";
ports = [ "6052:6052" ];
devices = [
"/dev/ttyUSB0"
];
privileged = true;
volumes = [
"/esphome:/config"
# Persist the PlatformIO core dir (penv, packages, platforms) so the
# pioarduino penv_setup.py dependency install only runs once rather
# than on every container restart.
"/esphome/.platformio:/root/.platformio"
];
environment = {
TZ = "America/Chicago";
};
};
# Open the ESPHome dashboard port
networking.firewall.allowedTCPPorts = [ 6052 ];
};
}