From 0ee4239e62c8848eb39dad287cd7d7d77831bc58 Mon Sep 17 00:00:00 2001 From: sinavir Date: Sun, 21 Apr 2024 13:55:43 +0200 Subject: [PATCH] feat: add helper functions to filter probes in lib --- lib/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/default.nix b/lib/default.nix index c1549aa..e077f7f 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -2,6 +2,18 @@ rec { mkFqdn = _: cfg: cfg.networking.fqdn; + probesWithTag = + { + name, + value ? null, + }: + probesConfig: + lib.filterAttrs ( + k: v: lib.any (tag: tag.name == name && (value == null || tag.value == value)) v.tags + ) probesConfig.monitors; + + probesWithType = type: probesConfig: lib.filterAttrs (_: v: v.type == type) probesConfig.monitors; + fromHive = { builder,