From 6905291dafba44ed414f4bc800ac0e09db5cbf9b Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 3 Apr 2021 12:04:57 +0200 Subject: libcmd/installables: force re-evaluation of cached failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- src/libexpr/eval-cache.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libexpr/eval-cache.hh') diff --git a/src/libexpr/eval-cache.hh b/src/libexpr/eval-cache.hh index e23e45c94..43b34ebcb 100644 --- a/src/libexpr/eval-cache.hh +++ b/src/libexpr/eval-cache.hh @@ -102,7 +102,7 @@ public: std::shared_ptr getAttr(std::string_view name); - std::shared_ptr findAlongAttrPath(const std::vector & attrPath); + std::shared_ptr findAlongAttrPath(const std::vector & attrPath, bool force = false); std::string getString(); -- cgit v1.2.3