(Full disclosure: I’m a nixos noobie. I’ve read the nix pills but am still trying to get a handle on how things work.)
I installed nix package manager on my Devuan system and am trying to understand why upgrading always creates garbage, even when the upgrade is performed on a fully up-to-date system.
See below (things to note: I start at generation 2 and a garbage collection finds no garbage. Then I perform an upgrade operation that does nothing because the system is already fully up-to-date. After the upgrade I’m still at generation 2):
$ nix-env --list-generations
2 2020-08-06 14:42:32 (current)
$ nix-collect-garbage -d
removing old generations of profile /nix/var/nix/profiles/per-user/bruno/channels
removing old generations of profile /nix/var/nix/profiles/per-user/bruno/profile
finding garbage collector roots...
deleting garbage...
deleting '/nix/store/trash'
deleting unused links...
note: currently hard linking saves -0.00 MiB
0 store paths deleted, 0.00 MiB freed
$ nix-channel --update; nix-env --upgrade
unpacking channels...
$ nix-env --list-generations
2 2020-08-06 14:42:32 (current)
But after the above, nix-collect-garbage -d
finds a ton of garbage:
$ nix-collect-garbage -d
removing old generations of profile /nix/var/nix/profiles/per-user/bruno/channels
removing old generations of profile /nix/var/nix/profiles/per-user/bruno/profile
finding garbage collector roots...
deleting garbage...
deleting '/nix/store/1yic9l55n84mklzlf3pqrg9jqzxkz7y6-openmpi-4.0.4.drv'
deleting '/nix/store/8xb9a32cgl1xiq77ns0vl14jzdzmcnsc-ucx-1.8.1.drv'
deleting '/nix/store/062pyx3824q3bkmi15001121mn4cprvj-rdma-core-30.0.drv'
deleting '/nix/store/1n77zjzs790lw1fxwzl82lmjb472mjl8-pandoc-2.9.2.1.drv'
deleting '/nix/store/qda5wfi6hxb615bzsqm995xbdk8f73b7-texmath-0.12.0.2.drv'
deleting '/nix/store/6p1ylm7pjndvva2nsxg1lz8hhz6bzw9s-pandoc-types-1.20.drv'
deleting '/nix/store/00jqykjj439g8sixpq1c6q4shli9i7h8-string-qq-0.0.4.drv'
deleting '/nix/store/v19drkx1p50gvsspyd34npbmppj6nkpm-http-client-tls-0.3.5.3.drv'
deleting '/nix/store/08lpjf8a1n5a7652d2fz9hqhzll5f2y0-connection-0.3.1.drv'
deleting '/nix/store/6xhbifrlzr7gba4khrq1pav3382z2zx0-x509-system-1.6.6.drv'
---snip---
deleting '/nix/store/p46prhgmv7ibjh9igfkbc6zfxbbi6sk5-dont-hardcode-cc.patch'
deleting '/nix/store/gm1vihrf3d8hks2fgjfgfyn5wm2rs49a-locales-builder.sh'
deleting '/nix/store/shpjchz7kli6y3xbdbab34q009v5hl4h-Use-stdlib-uint-instead-of-u_int.patch'
deleting '/nix/store/trash'
deleting unused links...
note: currently hard linking saves -0.00 MiB
2304 store paths deleted, 7.90 MiB freed
Can someone please help me understand how an upgrade operation on a fully up-to-date system creates garbage?