Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Have the ability to show closure size when using --derivation #46

Open
ursi opened this issue Dec 6, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@ursi
Copy link

ursi commented Dec 6, 2022

I was trying to find why a derivation was taking up so much space. The best way I could figure out how to do it, with any tools, was to use nix-tree --derivation (without derivation I got basically no information). Unfortunately, when I use --derivation, the sizes nix-tree displays are the size of the .drv files, not the size of the outputs they correspond to, so I had to go through the tree and manually check each one with nix path-info -sh. I would really like it if there was a feature where I could see all derivations needed by a particular derivations, and how big their closures were.

@utdemir utdemir added the enhancement New feature or request label Dec 13, 2023
@utdemir
Copy link
Owner

utdemir commented Dec 13, 2023

I agree that this would be great. But with a quick glance at the output of nix path-info I don't know how to get it (all nix-tree does it to present the output from nix path-info):

Here's what we get from a .drv file:

[
  {
    "ca": "text:sha256:09032k2k62hs2rdci4d73m0700x8lg3y5akjsmfm1vwisqaja0yx",
    "narHash": "sha256-fRoQmEOYFdaO1RUirIIRyPvYr4DgtGjkwhmxIlwA6QQ=",
    "narSize": 10976,
    "path": "/nix/store/78vq5lqc8zc293p5l1pi8mclpdc7srjl-nix-tree-0.3.2.drv",
    "references": [
      "/nix/store/0f5651q4ad0f8kmnw7wnjzvjvar1xx1k-hedgehog-1.2.drv",
      "/nix/store/0yj0vb9cgz12qfh44748aq8igpr680ih-brick-1.9.drv",
      "/nix/store/23iz5hzg1k3zz6hg1s3vv0l6a4jr1f35-microlens-0.4.13.1.drv",
      "/nix/store/23rvqfz487pldw8g9l47j1smzvxirssp-relude-1.2.1.0.drv",
      "/nix/store/4mdp8nhyfddh7bllbi7xszz7k9955n79-Setup.hs",
      "/nix/store/6fy2r0i30qib0kh45mlkkjd1rkr9bqkv-aeson-2.1.2.1.drv",
      "/nix/store/7vanskz0pcjzl8733fl5n8lj6lc9mlip-stdenv-darwin.drv",
      "/nix/store/7w61llva61mlaq62dgz6420cv7898nhg-bash-5.2-p15.drv",
      "/nix/store/907d7wf2d113vlv8dlhi1i3d683gc1rs-unpretty-cabal-conf.awk",
      "/nix/store/a6jp2zh4970kxnzhnwq5pkk5jak6qfp8-gnugrep-3.11.drv",
      "/nix/store/h6m1z7vvi4jfw6pj9b5ijvp05p24flfg-optparse-applicative-0.17.1.0.drv",
      "/nix/store/n91kmq7mqdgrrpfzygrwkiff3vczdan8-coreutils-9.3.drv",
      "/nix/store/q102qffb637kr06lsjn1zrybs01gydl9-typed-process-0.2.11.1.drv",
      "/nix/store/r5r46wvv329iqilmsprx9d09c7awk6xz-hrfsize-0.0.2.drv",
      "/nix/store/rg6s4mzlfaynf7lndn4naxasdlp51aak-source",
      "/nix/store/s32q0nbjnm1nzwy5lfa7dbg7gv0gw8fh-unordered-containers-0.2.19.1.drv",
      "/nix/store/sflf2z2a8rbi2yq87df7pjapxfpbda6x-clock-0.8.4.drv",
      "/nix/store/svrj9sll3sfdmpwn8rz8rayyvm1z9s3d-ghc-9.4.8.drv",
      "/nix/store/v5vzabhax400n50n366qkqgkyfp0br2p-vty-5.38.drv",
      "/nix/store/v6x3cs394jgqfbi0a42pam708flxaphh-default-builder.sh",
      "/nix/store/wakr8bwj5ghyhl26vz866gy14bc2m6cs-remove-references-to.drv",
      "/nix/store/xw62q6v31bkl0l1p8qpbyn6fhva0hz51-terminal-progress-bar-0.4.2.drv",
      "/nix/store/zy871mjac4979r4nzfhgni5ksqamwh9a-async-2.2.4.drv"
    ],
    "registrationTime": 1702251131,
    "valid": true
  }
]

And here's one from the output:

[
  {
    "deriver": "/nix/store/78vq5lqc8zc293p5l1pi8mclpdc7srjl-nix-tree-0.3.2.drv",
    "narHash": "sha256-J9NGSgfPk2kXiuP53jGlWyRW69utXjMRo1L4+7fR+X0=",
    "narSize": 51749224,
    "path": "/nix/store/ii16nz4gvdmxal722ngd99qgjgkdfrq2-nix-tree-0.3.2",
    "references": [
      "/nix/store/f9m8fq8d8cfx8dw4y5p6p34gqpgli96w-gmp-with-cxx-6.3.0",
      "/nix/store/g5r20rs0qhcjcbf9dhbnbd9ksg0h0jmx-libiconv-50",
      "/nix/store/knf3077k6fhm0g5qw2z51m22afzhz279-ncurses-6.4",
      "/nix/store/lb9b1yj8l0zqgj5f28m4k1lw9wcj8d1m-libffi-3.4.4"
    ],
    "registrationTime": 1702507999,
    "ultimate": true,
    "valid": true
  }
]

As you can see, the output points out to the derivation file (through the deriver field), but the derivation doesn't point to output. So when you pass nix-tree a derivation, it doesn't even know whether that derivation is built or not, let alone the output it produced.

Unless someone can find a way to get the output path from a deriver, unfortunately I do not know of a (straightforward) way to get this info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants