-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eval cache: guard behind an eval setting whether or not to cache errors
When I run `nix build` on a broken attribute in a flake twice, I get the dreaded error: cached failure of attribute 'snens' This also happens when you re-run the previous command with `--show-trace`. While trying to fix that, Linus and I discovered that the eval cache was broken for use on local flakes (i.e. `nix build .#`) was broken which got fixed in the commit before. We decided to use an eval setting for that because `forceError` seems to have been added somewhat arbitrarily as argument to the functions of AttrCursor where this was needed at the time it was developed. The effect was that it was hard for us to understand when an invocation can force errors and when it doesn't. For instance, `AttrCursor::isDerivation()` never forces re-evaluation of errors, so if `maybeGetAttr("type")` is the first thing that breaks eval, you'd always run into a cached failure. For now, this is `true` by default because I think the current behavior with a properly working eval cache is pretty painful while hacking on (or with) a flake. Potential future improvements are * Setting `evalSettings.forceErrorsInEvalCache` to `false` for commands like `nix search`. * Allowing the eval cache to cache the full failure (right now, `failed_t` is empty). That way, you could get errors when re-running `nix build` without having to re-evaluate everything, perhaps even with traced. That's the solution Linus and I would prefer. Co-authored-by: Linus Heckemann <git@sphalerite.org>
- Loading branch information
1 parent
0255b04
commit 3dfb4bf
Showing
4 changed files
with
21 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters