Nix-tree: Interactively browse the dependency graph of your Nix derivations

I noticed that I spent a lot of time digging into the transitive dependencies of a store path, usually to trim down the closure size. So, I ended up creating a small terminal application to make it a bit easier.

Easiest way to understand what it is is to watch this console recording:


In case anyone else finds it useful: GitHub - utdemir/nix-tree: Interactively browse dependency graphs of Nix derivations.

I’m open to suggestions, bug reports or contributions.

Edit: This project has been renamed to “nix-tree”. (It used to be “nixdu”)


Sweet! Any idea how to convince home-manager to install it?

1 Like

Awesome! I’ve always wanted to have such a tool. Reminds me of my crufty too long command that I always used that did something similar:

du -csh /nix/store/* | sort -rh | fzf --preview-window=right --preview='printf "\n%s\n" "@@@ $(du -sh {2}) @@@"; printf "\n%s\n" "@@@ referrers @@@"; nix-store -q --referrers {2}; printf "\n%s\n" "@@@ references @@@"; nix-store -q --references {2}' | awk '{print $2}'

Thank you :heart: so much for creating this. I’d love to see this in Nixpkgs or in the NUR. Also, I give you :star: :star: :star: :star: :star: for making nixdu it self a 4 references derivation :wink:

1 Like

I just added an overlay, so it should now can be with home-manager like:

nixpkgs.overlays = [
  (let url =;
    in import "${builtins.fetchTarball url}/overlay.nix" {})

home.packages = [ pkgs.nixdu ];

(I also added this example to README).

I haven’t tried this, so please let me know if this doesn’t work.


Here’s how I did it:

niv add utdemir/nixdu

then: add nixdu · ryantm/dotfiles@0ca66bb · GitHub

My dotfiles use a similar setup to home-manager template

Related tool with a very similar name: GitHub - symphorien/nix-du: Visualise which gc-roots to delete to free some space in your nix store

1 Like

Oh, that is my mistake, sorry. I should’ve checked before. I will mention that in the README.

Thinking about it, I decided to rename this project to nix-tree. Thank you for letting me know @lheckemann.


This is my third day using nix and this page was the first hit when I did a web search for nix view dependency tree.

Thank you for making and sharing this. I felt relief as soon as soon as I ran nix-tree.