summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-01-06 22:07:59 +0100
committerLudovic Courtès <ludo@gnu.org>2016-05-31 14:25:28 +0200
commitc56cd90cc93898ce4633cebc6ec5e490eb10fce4 (patch)
tree45d83e0efb12874e93dcba1f7de80a7a3f7d9721
parent1a9574e3a73e6ec1641c7238d87e45d00b862283 (diff)
daemon: When repairing, rebuild if there is no substituter.
-rw-r--r--nix/libstore/build.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index bbcb55a0b9..2f8b4dabba 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -3482,8 +3482,17 @@ void LocalStore::repairPath(const Path & path)
worker.run(goals);
- if (goal->getExitCode() != Goal::ecSuccess)
- throw Error(format("cannot repair path `%1%'") % path, worker.exitStatus());
+ if (goal->getExitCode() != Goal::ecSuccess) {
+ /* Since substituting the path didn't work, if we have a valid
+ deriver, then rebuild the deriver. */
+ Path deriver = queryDeriver(path);
+ if (deriver != "" && isValidPath(deriver)) {
+ goals.clear();
+ goals.insert(worker.makeDerivationGoal(deriver, StringSet(), bmRepair));
+ worker.run(goals);
+ } else
+ throw Error(format("cannot repair path `%1%'") % path, worker.exitStatus());
+ }
}