Interactive TUI viewer for Nix dependency graphs. Like nix-tree, but more feature rich (sort, filter, reverse (dependents) view) and not that cool (Not in Haskell).
Written in pure Go, no dependencies; only nix at runtime.
It runs nix path-info and renders the closure of the target as an expandable tree.
You can inverse graph at any node so tree becomes dependents tree.
Columns:
- NAR Size: The uncompressed size (in bytes) of store path after it is serialized into a Nix Archive (NAR) format.
- Closure size: Size of the store path and all its transitive dependencies.
- Added size: Size of the store path, and all its transitive dependencies minus sizes of already present dependencies in store, i.e., the cost of having that store path on top of all other paths.
Install from nixpkgs, or run it without installing:
nix run github:AlexAntonik/nix-graphNix profile:
nix profile add github:Alexantonik/nix-graphFlakes:
# flake.nix
{
inputs.nix-graph.url = "github:AlexAntonik/nix-graph";
inputs.nix-graph.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, nixpkgs, nix-graph }: {
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
({ pkgs, ... }: {
environment.systemPackages = [
inputs.nix-graph.packages.${pkgs.stdenv.hostPlatform.system}.nix-graph
];
})
];
};
};
}fetchTarball:
# configuration.nix
{ config, pkgs, ... }:
let
# replace this with an actual commit id or tag
commit = "0000000000000000000000000000000000000000";
nix-graph = import (builtins.fetchTarball {
url = "https://github.com/AlexAntonik/nix-graph/archive/${commit}.tar.gz";
# replace this with an actual hash
sha256 = "0000000000000000000000000000000000000000000000000000";
}) { inherit pkgs; };
in {
environment.systemPackages = [ nix-graph ];
# or home.packages = [ nix-graph ];
}nix-graph [path]where path is a store path, profile, or derivation (default: /run/current-system).
Examples:
nix-graph # current system closure
nix-graph "$(which bash)" # current bash closure
nix-graph /nix/store/x9...m-nix-2.34.8 # a specific package closure
nix-graph "$(nix eval --raw 'nixpkgs#bash.drvPath')" # a .drv: build-time graphPress p to flip the tree at selected node: the node you are on becomes root and the tree inverts, showing its dependents. Press p again and it flips back to dependencies.
That means you can walk down from the top level to some package, flip the view, trace your way back up to see what depends on it, flip again, and keep going back and forth as much as you want. esc resets to the default dependency tree, and P opens every package as its own root.
All contributions, issues and feature requests are welcome.