aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-04-29 15:42:53 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-04-29 15:42:53 +0200
commit70bcd6a55ccf583858342c2a1be6efe30167759c (patch)
tree8798d94d9b94fd072cdbc5c965c1549f22b3917e
parent5ada0831cfe1c8afb44bd9905901818696caaffa (diff)
Evaluation cache: Don't barf in read-only mode
Fixes $ nix copy warning: Git tree '/home/eelco/Dev/nix-flake' is dirty nix: src/nix/installables.cc:348: std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, nix::FlakeRef, nix::InstallableValue::DerivationInfo> nix::InstallableFlake::toDerivation(): Assertion `state->store->isValidPath(drvPath)' failed. Aborted (core dumped)
-rw-r--r--src/nix/installables.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index 6b9e2ee96..c2e2a6573 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -339,12 +339,14 @@ std::tuple<std::string, FlakeRef, InstallableValue::DerivationInfo> InstallableF
auto aDrvPath = attr->getAttr(state->sDrvPath);
auto drvPath = state->store->parseStorePath(aDrvPath->getString());
- if (!state->store->isValidPath(drvPath)) {
+ if (!state->store->isValidPath(drvPath) && !settings.readOnlyMode) {
/* The eval cache contains 'drvPath', but the actual path
has been garbage-collected. So force it to be
regenerated. */
aDrvPath->forceValue();
- assert(state->store->isValidPath(drvPath));
+ if (!state->store->isValidPath(drvPath))
+ throw Error("don't know how to recreate store derivation '%s'!",
+ state->store->printStorePath(drvPath));
}
auto drvInfo = DerivationInfo{