-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flake: disable eval cache on local repos #12102
base: master
Are you sure you want to change the base?
Conversation
Eval cache is useless when the cache key is the content of the repo, and the repo is being actively worked on. This is a first change towards not copying the local repo to the /nix/store on every eval.
What happens in case directory names become part of the evaluation and make evaluation between two different machines not reproducible? |
This can be solved by extending the string context to add non-store paths. Then have the derivation complain/abort if any of those are leaking into the build. |
Disabling the eval cache does nothing, since (without lazy trees) the tree is always copied to the store, regardless of eval caching. Note that since #11992, calculating a fingerprint for dirty Git trees is pretty cheap and doesn't read the entire repo. For non-dirty Git trees, it was already cheap.
How do you propose to do that without lazy trees while still maintaining hermetic evaluation and not changing any evaluation results? |
Hey Eeclo, This draft PR is mostly me making myself comfortable with the Nix internals. The full solution needs to also stop copying things to the /nix/store. The idea here to take a step back and explore an alternate road that doesn't tie Git so strongly to flakes and the Nix eval. What if it was possible to make the eval pure while not having a dependency on libgit2? In the short term this change would make the sandbox less strict. AFAIK it still disallows Then what remains are:
With those changes, libexpr would be stronger. Nix flakes becomes smaller. And Nix is generally smaller in terms of LOC. What do you think? |
Hermetic evaluation does not depend on libgit2. In fact the libgit2 dependency is pretty recent. We had hermetic evaluation when we were using |
Motivation
The most common complaint about flakes is that it copies the repo to the
/nix/store on each eval. This is especially annoying on large monorepos where
copying multiple GiB to the /nix/store outweighs whatever gains the eval cache
could bring.
Context
To solve this, turn off eval caching on local repositories.
I am aware of the lazy tree PR. This is a much simpler solution.
The current PR only implements 1/2 of the solution and turns off the eval
cache. The second change will be to stop copying the paths to the store.
Making this change will also automatically solve:
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.