-
-
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
--eval-store and faster closure copying #5048
Conversation
In particular, this now works: $ nix path-info --eval-store auto --store https://cache.nixos.org nixpkgs#hello Previously this would fail as it would try to upload the hello .drv to cache.nixos.org. Now the .drv is instantiated in the local store, and then we check for the existence of the outputs in cache.nixos.org.
With this, we don't have to copy the entire .drv closure to the destination store ahead of time (or at all). Instead, buildPaths() reads .drv files from the eval store and copies inputSrcs to the destination store if it needs to build a derivation. Issue NixOS#5025.
This adds a new store operation 'addMultipleToStore' that reads a number of NARs and ValidPathInfos from a Source, allowing any number of store paths to be copied in a single call. This is much faster on high-latency links when copying a lot of small files, like .drv closures. For example, on a connection with an 50 ms delay: Before: $ nix copy --to 'unix:///tmp/proxy-socket?root=/tmp/dest-chroot' \ /nix/store/90jjw94xiyg5drj70whm9yll6xjj0ca9-hello-2.10.drv \ --derivation --no-check-sigs real 0m57.868s user 0m0.103s sys 0m0.056s After: real 0m0.690s user 0m0.017s sys 0m0.011s
How can I enable |
You can't since it's not a config option and I'm not sure if it makes sense to turn it into one, since it could have unexpected interactions with scripts that use |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-16/14379/1 |
static ValidPathInfo read(Source & source, const Store & store, unsigned int format); | ||
static ValidPathInfo read(Source & source, const Store & store, unsigned int format, StorePath && path); | ||
|
||
void write(Sink & sink, const Store & store, unsigned int format, bool includePath = true) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be part of the core data type, but instead defined like and with the other serializers in src/libstore/worker-protocol.hh
.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-32/19865/1 |
When the Nix daemon is running remotely and is accessed via a high-latency connection, an operation like
nix build nixpkgs#hello
can be very slow because the client first needs to send a lot of .drv files one-by-one to the remote, each requiring a round trip. To make this faster, this PR does the following:It adds an option
--eval-store
that allows the evaluation to be done in a local Nix store. This is also useful for store that can't build, like binary caches. For instance, you can now do:It adds a new worker protocol interface to add multiple store paths in the same call. On a link with a 50 ms delay, this speeds up the copying of the
hello
.drv closure from 57.8s to 0.7s. Note that this disables parallel copying (the use ofprocessGraph()
with a thread pool incopyPaths()
is commented out).Fixes #5026.
Partially fixes #5025.