aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/local-derivation-goal.cc
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-08-22 17:07:14 -0700
committerJade Lovelace <lix@jade.fyi>2024-08-23 17:49:15 -0700
commit686120ee4a34f658b2f19dcac9f9dc44dbc98b93 (patch)
tree9c688afa704afc91724fdad259de4f3e447b6699 /src/libstore/build/local-derivation-goal.cc
parentc5949bfe313a92aab0e4cf38ab2407b0ac922ce8 (diff)
fix: good errors for failures caused by allowSubstitutes
This caused an absolute saga which I would not like anyone else to have to experience. Let's put in a laser targeted error message that diagnoses this exact problem. Fixes: https://git.lix.systems/lix-project/lix/issues/484 Change-Id: I2a79f04aeb4a1b67c10115e5e39501d958836298
Diffstat (limited to 'src/libstore/build/local-derivation-goal.cc')
-rw-r--r--src/libstore/build/local-derivation-goal.cc24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc
index 1e3c4109d..dadda4de2 100644
--- a/src/libstore/build/local-derivation-goal.cc
+++ b/src/libstore/build/local-derivation-goal.cc
@@ -436,13 +436,23 @@ std::set<int> LocalDerivationGoal::startBuilder()
killSandbox(false);
/* Right platform? */
- if (!parsedDrv->canBuildLocally(worker.store))
- throw Error("a '%s' with features {%s} is required to build '%s', but I am a '%s' with features {%s}",
- drv->platform,
- concatStringsSep(", ", parsedDrv->getRequiredSystemFeatures()),
- worker.store.printStorePath(drvPath),
- settings.thisSystem,
- concatStringsSep<StringSet>(", ", worker.store.systemFeatures));
+ if (!parsedDrv->canBuildLocally(worker.store)) {
+ HintFmt addendum{""};
+ if (settings.useSubstitutes && !parsedDrv->substitutesAllowed()) {
+ addendum = HintFmt("\n\nHint: the failing derivation has %s set to %s, forcing it to be built rather than substituted.\n"
+ "Passing %s to force substitution may resolve this failure if the path is available in a substituter.",
+ "allowSubstitutes", "false", "--always-allow-substitutes");
+ }
+ throw Error({
+ .msg = HintFmt("a '%s' with features {%s} is required to build '%s', but I am a '%s' with features {%s}%s",
+ drv->platform,
+ concatStringsSep(", ", parsedDrv->getRequiredSystemFeatures()),
+ worker.store.printStorePath(drvPath),
+ settings.thisSystem,
+ concatStringsSep<StringSet>(", ", worker.store.systemFeatures),
+ Uncolored(addendum))
+ });
+ }
/* Create a temporary directory where the build will take
place. */