flake-update-20260201
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 "okinawa"
23 "kobe"
24 ])
25 ) machines;
26
27 # Generate Prometheus targets from machine list
28 # Returns list of "hostname.domain:port" strings
29 mkPrometheusTargets =
30 {
31 machines,
32 domain ? "sbr.pm",
33 port,
34 }:
35 lib.mapAttrsToList (name: _machine: "${name}.${domain}:${toString port}") machines;
36}