1
0
Fork 0

lib/clerie-monitoring-ids.nix: Add functions to analyse assigned monitoring ids

This commit is contained in:
clerie 2024-04-20 14:34:42 +02:00
parent 2cdf09c5ae
commit 5ebe26caf8
3 changed files with 16 additions and 0 deletions

View File

@ -134,6 +134,8 @@
uptimestatus;
});
inherit lib self;
hydraJobs = {
inherit (self)
packages;

View File

@ -0,0 +1,13 @@
inputs:
with inputs.nixpkgs.lib;
rec {
monitoringIdForHost = host: let
evalResult = builtins.tryEval (attrByPath [ "clerie" "monitoring" "id" ] null host.config);
in
if evalResult.success then evalResult.value else null;
monitoringIdsByHost = hosts: filterAttrs (name: id: id != null) (mapAttrs (name: host: monitoringIdForHost host) hosts);
hostsByMonitoringIds = hosts: mapAttrs' (name: id: nameValuePair id name) (monitoringIdsByHost hosts);
monitoringIds = hosts: attrNames (hostsByMonitoringIds hosts);
}

View File

@ -14,6 +14,7 @@ let
generateColmenaHost
mapToColmenaHosts
buildHosts;
clerie-monitoring-ids = callLibs ./clerie-monitoring-ids.nix;
};
in