nix-super/doc/manual/source/package-management/garbage-collector-roots.md

19 lines
721 B
Markdown
Raw Normal View History

2020-07-23 00:17:48 +03:00
# Garbage Collector Roots
The roots of the garbage collector are all store paths to which there
are symlinks in the directory `prefix/nix/var/nix/gcroots`. For
instance, the following command makes the path
`/nix/store/d718ef...-foo` a root of the collector:
2020-07-31 16:43:25 +03:00
```console
$ ln -s /nix/store/d718ef...-foo /nix/var/nix/gcroots/bar
```
2020-07-23 00:17:48 +03:00
That is, after this command, the garbage collector will not remove
`/nix/store/d718ef...-foo` or any of its dependencies.
Subdirectories of `prefix/nix/var/nix/gcroots` are also searched for
symlinks. Symlinks to non-store paths are followed and searched for
roots, but symlinks to non-store paths *inside* the paths reached in
that way are not followed to prevent infinite recursion.