homelab/scripts/config.nix
plasmagoat bcbcc8b17b
Some checks failed
Test / tests (push) Has been cancelled
/ OpenTofu (push) Has been cancelled
homelab framework module init (everything is a mess)
2025-07-28 02:05:13 +02:00

18 lines
642 B
Nix

{
nodes,
lib,
...
}: let
extractGlobal = name: node:
if node ? config.homelab.global
then {
${name} = {
hostname = node.config.homelab.global.hostname;
monitoring = map (e: "${e.name}:${toString e.port}") node.config.homelab.global.monitoring.endpoints;
backups = map (b: "${b.name}(${b.backend})") node.config.homelab.global.backups.jobs;
proxy = map (p: "${p.subdomain}.${node.config.homelab.global.domain}") node.config.homelab.global.reverseProxy.entries;
};
}
else {};
in
lib.foldl (acc: name: acc // (extractGlobal name nodes.${name})) {} (builtins.attrNames nodes)