Skip to content

Nix garbage collector is implemented differently from how it is documented #3060

@arianvp

Description

@arianvp

https://nixos.org/nix/manual/#ssec-gc-roots mentions that /nix/var/nix/gcroots is the gcroot and that it is recursively following symlinks to find the store paths. However this behaviour was removed in aeb810b (why?)

We should probably update the documentation to reflect this. But I am confused for what reason this change was made in the first place.

It all started because I noticed that on my (new) system there is a symlink /nix/var/nix/gcroots/profiles -> /mnt/nix/var/nix/profiles (note the mnt) which is clearly an invalid symlink; yet nix-store --gc was still picking up paths in /nix/var/nix/profiles. I then git blame'd to discover that since recently /nix/var/nix/profiles is a direct gcroot and not an indirect one anymore.

So two questions in one:

  1. Why was this behaviour changed
  2. should we update the documentation?
  3. What part of the install process is creating this broken symlink to /mnt/nix/var/nix/profiles ? Should we just remove that part of the install process because /nix/var/nix/profiles is a direct gcroot anyway?

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions