# scripts/generate-docs.sh
#!/bin/bash

echo "# Homelab Global Configuration Documentation"
echo
echo "This document describes the global configuration system for the NixOS homelab."
echo
echo "## Available Services"
echo

# List all service modules
find modules/nixos/services -name "*.nix" | while read -r file; do
    service=$(basename "$file" .nix)
    echo "### $service"
    echo
    # Extract description from the module
    grep -m1 "mkEnableOption" "$file" | sed 's/.*mkEnableOption "\([^"]*\)".*/\1/' || echo "Service module for $service"
    echo
done

echo "## Configuration Examples"
echo
echo "### Basic Media Server Setup"
echo '```nix'
echo 'media-server = { ... }: {'
echo '  homelab.global = {'
echo '    enable = true;'
echo '    hostname = "media-server";'
echo '    domain = "homelab.local";'
echo '  };'
echo '  services.jellyfin.enable = true;'
echo '};'
echo '```'
echo

echo "### Monitoring Configuration"
echo '```nix'
echo 'monitoring = { nodes, ... }: {'
echo '  services.prometheus.scrapeConfigs = collectMonitoringEndpoints nodes;'
echo '};'
echo '```'# modules/global-config.nix
