summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nix/libstore/build.cc4
1 files changed, 4 insertions, 0 deletions
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);
 }