Hello, On popular demand ;-), commit 6e37066 finally exposes the daemon’s --gc-keep-derivations and --gc-keep-outputs options, which control exactly what the daemon will reclaim (see documentation below.) The commit is small, because that functionality was already present in the Nix daemon, just not exposed in guix-daemon.
The idea is that on a developer’s machine the daemon would run with --gc-keep-outputs (and --gc-keep-derivations, which is the default.) I think this addresses a longstanding inconvenience, where running the GC would delete all the build tools and sources, unless they happened to be live. Comments welcome. Ludo’. ‘--gc-keep-outputs[=yes|no]’ Tell whether the garbage collector (GC) must keep outputs of live derivations. When set to “yes”, the GC will keep the outputs of any live derivation available in the store—the ‘.drv’ files. The default is “no”, meaning that derivation outputs are kept only if they are GC roots. ‘--gc-keep-derivations[=yes|no]’ Tell whether the garbage collector (GC) must keep derivations corresponding to live outputs. When set to “yes”, as is the case by default, the GC keeps derivations—i.e., ‘.drv’ files—as long as at least one of their outputs is live. This allows users to keep track of the origins of items in their store. Setting it to “no” saves a bit of disk space. Note that when both ‘--gc-keep-derivations’ and ‘--gc-keep-outputs’ are used, the effect is to keep all the build prerequisites (the sources, compiler, libraries, and other build-time tools) of live objects in the store, regardless of whether these prerequisites are live. This is convenient for developers since it saves rebuilds or downloads.