aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/installables.cc
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2021-04-03 12:04:57 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2021-04-19 19:51:04 +0200
commit6905291dafba44ed414f4bc800ac0e09db5cbf9b (patch)
treeeb6efc5b6de0d638b90442de507ce5727915963b /src/libcmd/installables.cc
parent76980a1f3daf6d2890f7686bfc8cdf6a8b9e8dae (diff)
libcmd/installables: force re-evaluation of cached failures
I think that it's not very helpful to get "cached failures" in a wrong `flake.nix`. This can be very confusing when debugging a Nix expression. See for instance NixOS/nixpkgs#118115. In fact, the eval cache allows a forced reevaluation which is used for e.g. `nix eval`. This change makes sure that this is the case for `nix build` as well. So rather than λ ma27 [~/Projects/exp] → ../nix/outputs/out/bin/nix build -L --rebuild --experimental-features 'nix-command flakes' error: cached failure of attribute 'defaultPackage.x86_64-linux' the evaluation of already-evaluated (and failed) attributes looks like this now: λ ma27 [~/Projects/exp] → ../nix/outputs/out/bin/nix build -L --rebuild --experimental-features 'nix-command flakes' error: attribute 'hell' missing at /nix/store/mrnvi9ss8zn5wj6gpn4bcd68vbh42mfh-source/flake.nix:6:35: 5| 6| packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hell; | ^ 7| (use '--show-trace' to show detailed location information)
Diffstat (limited to 'src/libcmd/installables.cc')
-rw-r--r--src/libcmd/installables.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc
index 5d3026c1a..e15addfae 100644
--- a/src/libcmd/installables.cc
+++ b/src/libcmd/installables.cc
@@ -503,7 +503,11 @@ std::tuple<std::string, FlakeRef, InstallableValue::DerivationInfo> InstallableF
auto root = cache->getRoot();
for (auto & attrPath : getActualAttrPaths()) {
- auto attr = root->findAlongAttrPath(parseAttrPath(*state, attrPath));
+ auto attr = root->findAlongAttrPath(
+ parseAttrPath(*state, attrPath),
+ true
+ );
+
if (!attr) continue;
if (!attr->isDerivation())