$ show oddlama/nix-topology
nix-topology is a NixOS-based tool that automatically generates infrastructure and network diagrams as SVGs from NixOS configurations. It uses a global topology module to aggregate information from multiple NixOS hosts, extracting data about interfaces, services, containers, and virtual machines via specialized extractors. The gathered topology is then rendered using ELK for layout and converted to SVG via custom tools (elk-to-svg and html-to-svg), producing both a physical connection diagram (showing nodes as cards with hardware and service details) and a network-centric view (showing logical networks and their connections). The architecture is modular, with clear separation between information gathering, topology aggregation, and rendering.
The LLM identified 4 files worth highlighting for reuse:
A standalone Node.js package that converts ELK JSON graph descriptions to SVG. It handles complex edge routing, including shared bend points to avoid visual artifacts, and optimizes the output SVG. Demonstrates non-obvious skill in computational geometry and SVG path generation.
A standalone Node.js package that converts satori-compatible HTML to SVG. It integrates with the satori library to render HTML text and layouts into vector graphics, providing a simple CLI interface. Reusable for any project needing HTML-to-SVG conversion with custom fonts.
Provides helper functions (mkInternet, mkSwitch, mkRouter, mkDevice) for defining reusable topology nodes in Nix. Encapsulates non-trivial logic for interface groups and shared network propagation, allowing users to quickly define common network devices with minimal boilerplate. Self-contained and only depends on the Nix lib.
Defines lazy value types for NixOS module options, enabling deferred evaluation of option values. This utility solves a common problem in Nix module design where options need to be defined without immediate evaluation, and is reusable across any Nix project requiring lazy values.