From 6d03c084a04cb96ed474e291e054db8a9343a2ba Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Sun, 8 Dec 2024 22:31:14 +0100 Subject: [PATCH] feat(hive): Add serverNodes to the arguments --- hive.nix | 7 +++++++ machines/nixos/rescue01/uptime-kuma.nix | 6 +----- machines/nixos/storage01/prometheus.nix | 5 ++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hive.nix b/hive.nix index b3e9e54..7e08684 100644 --- a/hive.nix +++ b/hive.nix @@ -122,9 +122,12 @@ in evalConfig = args: import "${args.specialArgs.sourcePkgs.path}/nixos/lib/eval-config.nix" args; defaults = { + lib, name, + nodes, nodeMeta, nodePath, + meta, sourcePkgs, ... }: @@ -138,6 +141,10 @@ in ./modules/${category name} ]; + _module.args.serverNodes = lib.filterAttrs ( + name: _: meta.nodes.${name}.nixpkgs.system == "nixos" + ) nodes; + # Include default secrets age-secrets.sources = [ ./${nodePath}/secrets ]; diff --git a/machines/nixos/rescue01/uptime-kuma.nix b/machines/nixos/rescue01/uptime-kuma.nix index 8082917..6e89511 100644 --- a/machines/nixos/rescue01/uptime-kuma.nix +++ b/machines/nixos/rescue01/uptime-kuma.nix @@ -1,15 +1,13 @@ { config, lib, - meta, - nodes, + serverNodes, sources, ... }: let inherit (lib) concatLists - filterAttrs mapAttrsToList mkForce mkMerge @@ -22,8 +20,6 @@ let probesWithTag ; - serverNodes = filterAttrs (name: _: meta.nodes.${name}.nixpkgs.system == "nixos") nodes; - probesCfg = config.statelessUptimeKuma.probesConfig; mkMonitors = name: builtins.attrNames (probesWithTag { inherit name; } probesCfg); diff --git a/machines/nixos/storage01/prometheus.nix b/machines/nixos/storage01/prometheus.nix index 455ab3e..70063fe 100644 --- a/machines/nixos/storage01/prometheus.nix +++ b/machines/nixos/storage01/prometheus.nix @@ -1,7 +1,6 @@ { config, - meta, - nodes, + serverNodes, lib, ... }: @@ -20,7 +19,7 @@ let host = node; }; } - ) (lib.filterAttrs (name: _: meta.nodes.${name}.nixpkgs.system == "nixos") nodes) + ) serverNodes ); in