aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build/derivation-goal.cc8
-rw-r--r--src/libstore/store-api.hh23
2 files changed, 31 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;
+ }
}
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 3a385b293..3dd446f23 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -155,6 +155,29 @@ struct BuildResult
} status = MiscFailure;
std::string errorMsg;
+ std::string toString() const {
+ auto strStatus = [&]() {
+ switch (status) {
+ case Built: return "Built";
+ case Substituted: return "Substituted";
+ case AlreadyValid: return "AlreadyValid";
+ case PermanentFailure: return "PermanentFailure";
+ case InputRejected: return "InputRejected";
+ case OutputRejected: return "OutputRejected";
+ case TransientFailure: return "TransientFailure";
+ case CachedFailure: return "CachedFailure";
+ case TimedOut: return "TimedOut";
+ case MiscFailure: return "MiscFailure";
+ case DependencyFailed: return "DependencyFailed";
+ case LogLimitExceeded: return "LogLimitExceeded";
+ case NotDeterministic: return "NotDeterministic";
+ case ResolvesToAlreadyValid: return "ResolvesToAlreadyValid";
+ default: return "Unknown";
+ };
+ }();
+ return strStatus + ((errorMsg == "") ? "" : " : " + errorMsg);
+ }
+
/* How many times this build was performed. */
unsigned int timesBuilt = 0;