diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc index efe1ab2b17..ab33f57265 100644 --- a/nix/libstore/build.cc +++ b/nix/libstore/build.cc @@ -882,6 +882,10 @@ DerivationGoal::DerivationGoal(const Path & drvPath, const StringSet & wantedOut state = &DerivationGoal::init; name = (format("building of `%1%'") % drvPath).str(); trace("created"); + + /* Prevent the .chroot directory from being + garbage-collected. (See isActiveTempFile() in gc.cc.) */ + worker.store.addTempRoot(drvPath); }