Subject: bug#38469: guix gc should keep around recent intermediate build ingredients by default

From: Guillaume Le Vaillant <[email-masked]>
Date: Tue, 03 Dec 2019 13:59:22 +0100

Robert Vollmert skribis:

> [ This is a user/developer friendliness feature request. I’m not arguing
>   that `guix gc` should do anything differently on a technical level, I’m
>   just trying to argue that the default experience should be different. ]
>
> Current situation:
>   I use a forked guix repository as my default channel, which
>   includes a number of slow-to-build Haskell packages. Now and
>   then, I run out of disk space. So I call `guix gc`, which invariably
>   removes the store paths involved in building my current system generation,
>   so the next call to `guix system reconfigure` takes hours.
>
> Desired situation:
>   After calling `guix gc`, the paths that were involved in my last system
>   build are still around, so reconfiguring doesn’t result in everything
>   being rebuilt.
>
> (If there’s some way I can achieve that now, perhaps by explicitly managing
> some roots, or passing specific arguments to `guix gc`, I’d be happy to
> know! I’d still argue that we should try to make this the default behaviour,
> though.)

Have you tried passing the options '--gc-keep-derivations=yes' and
'--gc-keep-outputs=yes' to guix-daemon?

In the operating-system definition, it would be something like:
--8<---------------cut here---------------start------------->8---
(services
   (cons* (service ...)
          [...]
          (modify-services %desktop-services
            (guix-service-type config =>
              (guix-configuration
               (inherit config)
               (extra-options '("--gc-keep-derivations=yes"
                                "--gc-keep-outputs=yes")))))))
--8<---------------cut here---------------end--------------->8---