homelab/pkgs/homelab-docs/main.nix
plasmagoat 73d2f44d74
Some checks failed
Test / tests (push) Failing after 2m27s
/ OpenTofu (push) Successful in 9s
updated docs
2025-07-29 16:58:09 +02:00

73 lines
2.2 KiB
Nix
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{writeShellScriptBin}:
writeShellScriptBin "homelab-generate-docs" ''
#!/usr/bin/env bash
set -euo pipefail
# Colors
BLUE='\033[0;34m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
info() { echo -e "''${BLUE}$1''${NC}"; }
success() { echo -e "''${GREEN}$1''${NC}"; }
warn() { echo -e "''${YELLOW}$1''${NC}"; }
error() { echo -e "''${RED}$1''${NC}"; }
# Configuration
DOCS_DIR="''${1:-./docs}"
info "📚 Generating homelab documentation..."
echo " Output directory: $DOCS_DIR"
echo
# Check if we're in a directory with a flake
if [[ ! -f flake.nix ]]; then
error "No flake.nix found in current directory"
echo "Please run this command from your homelab flake directory"
exit 1
fi
# Check if colmena is available
if ! command -v colmena >/dev/null 2>&1; then
error "colmena command not found."
echo "Please ensure colmena is available in your environment"
exit 1
fi
# Create docs directory
mkdir -p "$DOCS_DIR"
# Generate fleet overview
info " 🌐 Generating fleet overview..."
homelab-docs-fleet > "$DOCS_DIR/fleet-overview.md"
# Generate node documentation
info " 🖥 Generating node configurations..."
homelab-docs-nodes > "$DOCS_DIR/nodes.md"
# Generate service documentation
info " Generating service configurations..."
homelab-docs-services > "$DOCS_DIR/services.md"
# Generate current deployment
info " 🏠 Generating current deployment..."
homelab-docs-deployment > "$DOCS_DIR/current-deployment.md"
# Generate README
info " 📋 Generating README..."
homelab-docs-readme > "$DOCS_DIR/README.md"
success " Documentation generated successfully!"
echo
echo "Generated files:"
echo " 🌐 fleet-overview.md - Fleet statistics and overview"
echo " 🖥 nodes.md - Per-node configurations"
echo " services.md - Service configurations"
echo " 🏠 current-deployment.md - Current deployment state"
echo " 📋 README.md - Documentation index"
echo
echo "💡 Tip: Add these files to your repository and set up GitHub Actions"
echo " to automatically regenerate documentation on changes!"
''