flake-update-20260505
1{ lib }:
2{
3 # Filter machines with node exporters
4 # Excludes non-NixOS machines, mobile devices, and machines without network config
5 machinesWithNodeExporter =
6 machines:
7 lib.filterAttrs (
8 name: machine:
9 # Has network configuration with names (indicates it's a real host)
10 (machine ? net && machine.net ? names)
11 # Exclude mobile devices and tablets
12 && !(builtins.elem name [
13 "hokkaido"
14 "suzu"
15 "osaka"
16 ])
17 # Exclude non-NixOS machines that don't run node exporter
18 && !(builtins.elem name [
19 "synodine"
20 "hass"
21 "wakasu"
22 ])
23 ) machines;
24
25 # Generate Prometheus targets from machine list
26 # Returns list of "hostname.domain:port" strings
27 mkPrometheusTargets =
28 {
29 machines,
30 domain ? "sbr.pm",
31 port,
32 }:
33 lib.mapAttrsToList (name: _machine: "${name}.${domain}:${toString port}") machines;
34}