add data/services.nix for shared service definitions

Creates a standalone data file that can be imported by both
aspects/constants.nix and terranix configurations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
William 2026-02-06 22:46:49 -03:00
parent 848f79f8bb
commit bde5e2aabc
20 changed files with 189 additions and 57 deletions

View file

@ -6,7 +6,15 @@
{ config, lib, ... }:
let
inherit (import ../../shared/services.nix) services;
sharedData = import ../../data/services.nix;
# Enrich services with host IPs
services = map (svc:
let hostInfo = sharedData.hosts.${svc.host} or {};
in svc // {
lanIP = hostInfo.lanIP or null;
tailscaleIP = hostInfo.tailscaleIP or null;
}
) sharedData.services;
# Helper to extract subdomain from full domain (e.g., "git.baduhai.dev" -> "git")
getSubdomain = domain: lib.head (lib.splitString "." domain);