giomf/NixoScope
Visualize dependencies between NixOS modules
{ "createdAt": "2026-02-25T22:16:24Z", "defaultBranch": "main", "description": "Visualize dependencies between NixOS modules", "fullName": "giomf/NixoScope", "homepage": "", "language": "Python", "name": "NixoScope", "pushedAt": "2026-03-14T07:53:15Z", "stargazersCount": 23, "topics": [ "nixos" ], "updatedAt": "2026-03-17T03:02:58Z", "url": "https://github.com/giomf/NixoScope"}NixoScope
Section titled “NixoScope”Why This Tool Exists
Section titled “Why This Tool Exists”I recently switched to the dendritic design pattern with flake parts and needed a way to understand my module structure:
- Which modules get imported from other modules?
- Which modules get declared in what files?
Manually tracing these relationships through code was tedious and error-prone, so I built this tool to visualize the module dependency graph.
How It Works
Section titled “How It Works”This tool leverages the new .graph output introduced in the Nixpkgs module system.
Thanks to this merged PR, we can now obtain a JSON representing the tree of modules that took part in the evaluation of a configuration.
For more details, see the announcement on NixOS Discourse.
Installation
Section titled “Installation”Clone and run directly
Section titled “Clone and run directly”git clone https://github.com/giomf/nixoscopecd nixoscopepython -m nixoscope.nixoscope --helpInstall from nixpkgs
Section titled “Install from nixpkgs”nix-shell -p nixoscope# or with flakesnix profile install nixpkgs#nixoscopeRun without installing
Section titled “Run without installing”nix run github:giomf/nixoscope -- --helpObtaining the input graph:
Section titled “Obtaining the input graph:”nix eval --json '.#nixosConfigurations.<your-config>.graph' > graph.jsonRead the input graph:
Section titled “Read the input graph:”nixoscope --input graph.jsondefault: graph.json
Output format:
Section titled “Output format:”Graphviz:
Section titled “Graphviz:”nixoscope --format gvdefault: gv
Mermaid:
Section titled “Mermaid:”nixoscope --format mmdefault: gv
nixoscope --format jsondefault: gv
Filter by option prefix
Section titled “Filter by option prefix”nixoscope --option "flake.modules"Result
Section titled “Result”![Graphviz output]!(./docs/graph.svg)
Filtered by “flake.modules”
Section titled “Filtered by “flake.modules””![Graphviz output]!(./docs/graph-filtered.svg)
Disclaimer
Section titled “Disclaimer”This project uses AI as an aid.