aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2021-12-13 16:58:43 +0100
committerregnat <rg@regnat.ovh>2021-12-13 17:02:14 +0100
commit2eec2f765a86b8954f3a74ff148bc70a2d32be27 (patch)
treef28bddbe6156759e79a9ff4d5377ec33cb02e27f /src/libstore/build
parent55dbb7f1ccc0e991df6b09af0a16ce9246ac3f19 (diff)
Add a crude tracing mechansim for the build results
Add a `_NIX_TRACE_BUILT_OUTPUTS` environment variable that can be set to a filename in which the result of each build will be logged. This is intentionally crude and undocumented as it’s only meant to be a temporary thing to assess the usefulness of CA derivations. Any other use would need a cleaner re-implementation first.
Diffstat (limited to 'src/libstore/build')
-rw-r--r--src/libstore/build/derivation-goal.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index a713d7222..c6ab5c3d1 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -17,6 +17,7 @@
#include <regex>
#include <queue>
+#include <fstream>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -1337,6 +1338,13 @@ void DerivationGoal::done(BuildResult::Status status, std::optional<Error> ex)
}
worker.updateProgress();
+
+ auto traceBuiltOutputsFile = getEnv("_NIX_TRACE_BUILT_OUTPUTS").value_or("");
+ if (traceBuiltOutputsFile != "") {
+ std::fstream fs;
+ fs.open(traceBuiltOutputsFile, std::fstream::out);
+ fs << worker.store.printStorePath(drvPath) << "\t" << result.toString() << std::endl;
+ }
}