How do I find out how much storage a package uses once it’s installed via nixos config file?
I’ve used Disk Usage Analyzer (baobab), analyzed my / (nixos/nix/store/ and etc.), and it’s hard to understand.
How do I find out how much storage a package uses once it’s installed via nixos config file?
I’ve used Disk Usage Analyzer (baobab), analyzed my / (nixos/nix/store/ and etc.), and it’s hard to understand.
nix-store --query --size /nix/store/some-package is the short answer.
The longer answer is, it depends on why you want to know, for two reasons:
For a more sophisticated analysis, use nix-du, and be prepared to think harder about the question than you would probably like to.
I’m working with computers with different size storage (128GB, 256GB, 1TB, and etc.), and I’m trying to determine which packages I need to essentially keep, and which ones I don’t.
For instance, I have Firefox, Gnome Web, and Chromium browsers installed, in case someone had a preference, but if I had to cut one or two of these from the config, knowing the size could help me make the determination.
Another example is having multiple audio DAWs in a config, or file managers, and etc.
I also figured this might be the case.
If you’re only looking for hints on how much space you might free up by removing a program from your config, I recommend nix-tree.
nix-tree shows two sizes for each package: an unparenthesized size of that package’s entire closure, and a parenthesized size of just that package and its unique dependencies. AFAIK, neither takes store optimization into account, but ignoring that, the two sizes are upper and lower bounds, respectively, for how much space you could save by removing that package along with others.