Skip to content
Oeiuwq Faith Blog OpenSource Porfolio

giomf/NixoScope

Visualize dependencies between NixOS modules

giomf/NixoScope.json
{
"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"
}

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.

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.

Terminal window
git clone https://github.com/giomf/nixoscope
cd nixoscope
python -m nixoscope.nixoscope --help
Terminal window
nix-shell -p nixoscope
# or with flakes
nix profile install nixpkgs#nixoscope
Terminal window
nix run github:giomf/nixoscope -- --help
Terminal window
nix eval --json '.#nixosConfigurations.<your-config>.graph' > graph.json
Terminal window
nixoscope --input graph.json

default: graph.json

Terminal window
nixoscope --format gv

default: gv

Terminal window
nixoscope --format mm

default: gv

Terminal window
nixoscope --format json

default: gv

Terminal window
nixoscope --option "flake.modules"

![Graphviz output]!(./docs/graph.svg)

![Graphviz output]!(./docs/graph-filtered.svg)

This project uses AI as an aid.