How to get size of nix-shell dependencies?

Say I have default.nix with a mkShell. It is used only for nix-shell. I’d like to know size of all dependencies, but:

$ du -sch $(nix-store -qR $(nix-instantiate default.nix)) | tail -n1
7,8M    total

Well, that’s real size of all .drv-s, but what is size of all realized packages?

$ du -sch $(nix-store -qfR $(nix-instantiate default.nix)) | tail -n1
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
building '/nix/store/lwcsw4mmxm4gl15ycy8nwli0sr0jzvj4-nix-shell.drv'...
nobuildPhase

This derivation is not meant to be built, aborting

builder for '/nix/store/lwcsw4mmxm4gl15ycy8nwli0sr0jzvj4-nix-shell.drv' failed with exit code 1
error: build of '/nix/store/lwcsw4mmxm4gl15ycy8nwli0sr0jzvj4-nix-shell.drv' failed

How?

2 Likes