Files
nixos-servers/services/home-assistant/default.nix
Torjus Håkestad dd1b64de27
Some checks failed
Run nix flake check / flake-check (pull_request) Successful in 2m49s
Run nix flake check / flake-check (push) Has been cancelled
monitoring: auto-generate Prometheus scrape targets from host configs
Add homelab.monitoring NixOS options (enable, scrapeTargets) following
the same pattern as homelab.dns. Prometheus scrape configs are now
auto-generated from flake host configurations and external targets,
replacing hardcoded target lists.

Also cleans up alert rules: snake_case naming, fix zigbee2mqtt typo,
remove duplicate pushgateway alert, add for clauses to monitoring_rules,
remove hardcoded WireGuard public key, and add new alerts for
certificates, proxmox, caddy, smartctl temperature, filesystem
prediction, systemd state, file descriptors, and host reboots.

Fixes grafana scrape target port from 3100 to 3000.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 00:49:07 +01:00

75 lines
1.6 KiB
Nix

{ pkgs, config, ... }:
{
homelab.monitoring.scrapeTargets = [{
job_name = "home-assistant";
port = 8123;
metrics_path = "/api/prometheus";
scrape_interval = "60s";
}];
# Enable the Home Assistant service
services.home-assistant = {
enable = true;
package = pkgs.unstable.home-assistant;
configWritable = true;
config = null;
extraPackages =
python3Packages: with pkgs.unstable.python313Packages; [
aiopyarr
aioshelly
bellows
gtts
ha-silabs-firmware-client
isal
paho-mqtt
prometheus-client
pykodi
python-roborock
radios
uiprotect
unifi-discovery
universal-silabs-flasher
vacuum-map-parser-base
vacuum-map-parser-roborock
zha
zha-quirks
zigpy-cc
zigpy-deconz
zigpy-xbee
zigpy-zigate
zigpy-znp
zlib-ng
];
customComponents = with pkgs.home-assistant-custom-components; [
];
};
# Enable the mosquitto MQTT broker
services.mosquitto = {
enable = true;
persistence = true;
listeners = [
{
acl = [ "pattern readwrite #" ];
omitPasswordAuth = true;
settings.allow_anonymous = true;
}
];
};
# Enable the zigbee2mqtt service
services.zigbee2mqtt = {
enable = true;
package = pkgs.unstable.zigbee2mqtt;
settings = {
homeassistant = {
legacy_entity_attributes = false;
legacy_triggers = false;
};
availability = true;
frontend = true;
permit_join = false;
serial.port = "/dev/ttyUSB0";
};
};
}