No description
  • Rust 99.3%
  • Nix 0.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-03 10:58:17 +00:00
crates Fix 2026-09-03 10:58:17 +00:00
infra-client Complete refactor: TOML config + modular crates 2026-09-03 08:29:58 +00:00
.gitignore Complete refactor: TOML config + modular crates 2026-09-03 08:29:58 +00:00
.woodpecker.yml Initial commit: infra-map - Interactive infrastructure map for cyperpunk.de homelab 2026-09-02 15:26:18 +00:00
Cargo.toml Fix 2026-09-03 10:58:17 +00:00
flake.lock Fix workspace structure: move binary to crates/infra-map 2026-09-02 18:02:08 +00:00
flake.nix Add Nix flake for development environment 2026-09-02 15:50:12 +00:00
infra-map.toml Complete refactor: TOML config + modular crates 2026-09-03 08:29:58 +00:00
README.md Initial commit: infra-map - Interactive infrastructure map for cyperpunk.de homelab 2026-09-02 15:26:18 +00:00
REFACTOR_PLAN.md Complete refactor: TOML config + modular crates 2026-09-03 08:29:58 +00:00

infra-map

Interactive, real-time infrastructure map for the cyperpunk.de homelab.

Overview

infra-map is a Rust TUI application that discovers, monitors, and visualizes the entire homelab infrastructure defined in the cyper-nix Nix flake. It provides live health checks, service details, and an interactive explorable map of all machines and services.

Features

  • Static Discovery: Parses cyper-nix/flake.nix to extract machine definitions, roles, and service configurations
  • Live Health Monitoring: Real-time API health checks for all services (Matrix, Forgejo, SearXNG, Vaultwarden, Mastodon, Kanidm, etc.)
  • Interactive TUI: Keyboard-driven dashboard with tabs for Overview, Machines, Services, Matrix, Forgejo, SearXNG, Identity, Fediverse, Secrets, and Logs
  • Service Details: Deep-dive into each service with configuration, endpoints, and live metrics
  • Export: Export topology as JSON or GraphViz DOT
  • Woodpecker CI: Automated fmt, clippy, test, build, audit, and release pipelines

Architecture

cyperpunk.de homelab (5 machines)
├── cyper-desktop     (NixOS, x86_64, Desktop)
├── cyper-mac         (macOS, x86_64, Laptop)
├── cyper-controller  (NixOS, x86_64, Controller - runs all services)
├── cyper-node-1      (NixOS, x86_64, Server node)
└── cyper-node-2      (NixOS, x86_64, Server node)

Public Services:

  • Matrix (Synapse 1.158.0) - cyperpunk.de, cinny.cyperpunk.de
  • Forgejo 16.0.2 - git.cyperpunk.de (SSH: 12222)
  • SearXNG 2026.8.4 - search.cyperpunk.de / 10.10.0.2:11080
  • Vaultwarden - vault.cyperpunk.de
  • Mastodon (Cypersocial) - mastodon.cyperpunk.de
  • Kanidm SSO - auth.cyperpunk.de

Internal Services (VPN/LAN):

  • Prometheus, Grafana, AdGuard, UniFi, Woodpecker, JupyterHub, Coturn, LiveKit, FileBrowser

Installation

From Source

git clone https://git.cyperpunk.de/DerGrumpf/infrastructure.git
cd infrastructure
cargo install --path .

Nix Flake (for cyper-nix integration)

# In your flake.nix
inputs.infra-map.url = "git+https://git.cyperpunk.de/DerGrumpf/infrastructure.git";
# Then add infra-map.packages.${system}.infra-map to your system packages

Usage

# Run interactive TUI (requires cyper-nix at ../cyper-nix)
infra-map

# Custom flake path
infra-map --flake-path /path/to/cyper-nix

# Run once and output JSON (for scripting)
infra-map --once

# Debug mode
infra-map --debug

# Disable TLS verification (for self-signed certs)
infra-map --insecure

Environment Variables

export INFRA_MAP_GITEA_TOKEN="your_forgejo_token"
export INFRA_MAP_MATRIX_TOKEN="your_matrix_access_token"
export INFRA_MAP_VAULT_TOKEN="your_vaultwarden_token"

TUI Keybindings

Key Action
1-9 Switch to tab 1-9
Tab / Shift+Tab Next/Previous tab
/ Navigate lists
Enter Select/Drill down
r Refresh all services
Space Toggle auto-refresh
/ Filter mode
: Command palette
e Export topology (JSON)
o Open in browser
L View logs
s SSH into machine
h / ? Toggle help
q / Esc Quit (confirm on main screen)

Commands (via :)

:refresh          Refresh all services
:export           Export topology to JSON
:tab <name>       Switch to tab (e.g., :tab matrix)
:filter <text>    Set filter
:help             Show help
:quit / :exit     Quit application

Screenshots

(TUI screenshots would go here)

Configuration

The application reads configuration from:

  1. cyper-nix/flake.nix - Machine and service definitions
  2. Environment variables - Auth tokens
  3. Command line args - Overrides

Default Check Intervals

Service Interval
Matrix 30s
Forgejo 60s
SearXNG 60s
Vaultwarden 60s
Mastodon 60s
Kanidm 60s
Prometheus 30s
Grafana 60s
Coturn 300s
LiveKit 60s

Development

Prerequisites

  • Rust 1.79+
  • cyper-nix repository checked out at ../cyper-nix (or specify with --flake-path)

Building

cargo build --release --workspace

Testing

cargo test --workspace

Linting

cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo audit

CI/CD

Woodpecker pipeline (.woodpecker.yml):

  • fmt: Code formatting check
  • clippy: Linting with deny warnings
  • test: Full test suite
  • build: Release build
  • audit: Security audit
  • docs: Documentation generation
  • release: Binary build and strip on version tags

Project Structure

infra-map/
├── Cargo.toml                 # Workspace root
├── .woodpecker.yml           # CI pipeline
├── src/
│   └── main.rs               # Binary entry point
├── crates/
│   ├── infra-core/           # Core data models
│   ├── infra-discovery/      # Nix flake parsing & static discovery
│   ├── infra-api/            # Live API clients
│   ├── infra-monitor/        # Real-time health monitoring
│   └── infra-tui/            # Ratatui TUI application
└── tests/                    # Integration tests

Data Flow

cyper-nix/flake.nix
       │
       ▼
StaticDiscovery (infra-discovery)
       │
       ▼
NetworkTopology (machines, services, connections)
       │
       ▼
HealthMonitor (infra-monitor) ◄── ApiClients (infra-api) ──► Live APIs
       │
       ▼
ClusterHealth (watch channel)
       │
       ▼
App (infra-tui) ──► Terminal (ratatui/crossterm)

License

MIT OR Apache-2.0