[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'guix build' and garbage collection

From: Chris Marusich
Subject: Re: 'guix build' and garbage collection
Date: Sun, 02 Apr 2017 23:40:16 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> Hi Chris,
> Chris Marusich <address@hidden> skribis:
>> I saw this in guix/
>> (and (build-derivations store drv mode)
>>      (for-each show-derivation-outputs drv)
>>      (for-each (cut register-root store <> <>)
>>                (map (lambda (drv)
>>                       (map cdr
>>                            (derivation->output-paths drv)))
>>                     drv)
>>                roots))
>> Here, we build the derivations, and then we add indirect GC roots.  My
>> question is: what guarantee is there that the output paths will not be
>> garbage collected after we build the derivations but before we add the
>> indirect GC roots?
> For the duration of the connection to the build daemon, build results
> are registered as GC roots, so we’re fine.
> You can see it in the ‘DerivationGoal’ constructor in libstore/
>     /* Prevent the .chroot directory from being
>        garbage-collected. (See isActiveTempFile() in */
> Likewise in ‘SubstitutionGoal::init’.
> HTH,
> Ludo’.

That's exactly what I was missing.  Thank you for the information.

My understanding is that Nix builds derivations in a temporary
directory.  My understanding is that eventually, we copy the results of
the build into the final, content-addressed store path.  Since we don't
know the final, content-addressed store path until after we calculate
the hash of the output, how do we prevent that final store path from
being garbage collected while the build process is running?  Do we use
addTempRoot to add the final, content-addressed store path as a
temporary root, too?  I looked in the code but couldn't figure this out.


Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]