about summary refs log tree commit diff
path: root/scripts/download-from-binary-cache.pl.in
AgeCommit message (Collapse)AuthorFilesLines
2012-11-06 download-from-binary-cache: Try next cache if downloading a NAR failsEelco Dolstra1-1/+1
2012-11-06 Process binary caches in order of priorityEelco Dolstra1-7/+14
Binary caches can now specify a priority in their nix-cache-info file. The binary cache substituter checks caches in order of priority. This is to ensure that fast, static caches like nixos.org/binary-cache are processed before slow, dynamic caches like hydra.nixos.org.
2012-11-06 Add an option ‘use-binary-caches’Eelco Dolstra1-0/+4
This allows disabling the use of binary caches, e.g. $ nix-build ... --option use-binary-caches false Note that $ nix-build ... --option binary-caches '' does not disable all binary caches, since the caches defined by channels will still be used.
2012-11-06 Fix "Not an ARRAY reference" errorEelco Dolstra1-1/+1
It's a mystery why this error is not triggered in the build farm (e.g. http://hydra.nixos.org/build/3265602). Ah well.
2012-10-17 nix-push: Only generate and copy a NAR if it doesn't already existEelco Dolstra1-40/+10
This prevents unnecessary and slow rebuilds of NARs that already exist in the binary cache.
2012-10-11 download-from-binary-cache: Remove duplicate entries in trustedURLsEelco Dolstra1-1/+1
2012-10-02 Add operation ‘nix-store --repair-path’Eelco Dolstra1-3/+4
This operation allows fixing corrupted or accidentally deleted store paths by redownloading them using substituters, if available. Since the corrupted path cannot be replaced atomically, there is a very small time window (one system call) during which neither the old (corrupted) nor the new (repaired) contents are available. So repairing should be used with some care on critical packages like Glibc.
2012-09-21 Style fixEelco Dolstra1-1/+1
2012-09-13 Put a time-to-live on negative binary cache lookupsEelco Dolstra1-3/+30
Negative lookups are purged from the DB after a day, at most once per day. However, for non-"have" lookups (e.g. all except "nix-env -qas"), negative lookups are ignored after one hour. This is to ensure that you don't have to wait a day for an operation like "nix-env -i" to start using new binaries in the cache. Should probably make this configurable.
2012-09-13 DohEelco Dolstra1-2/+2
2012-09-13 Delete manifests in "nix-channel --remove" or when a binary cache is availableEelco Dolstra1-0/+1
2012-09-12 Compatibility fix for WWW::Curl < 4.14Eelco Dolstra1-1/+2
Older versions of WWW::Curl don't support scalar references for CURLOPT_WRITEDATA directly. http://hydra.nixos.org/build/3017188
2012-08-27 Disable the binary cache substituter by default for nowEelco Dolstra1-3/+2
2012-08-27 Drop dependency on List::MoreUtilsEelco Dolstra1-3/+2
2012-08-01 nix-channel: Use binary caches advertised by channelsEelco Dolstra1-0/+10
Channels can now advertise a binary cache by creating a file <channel-url>/binary-cache-url. The channel unpacker puts these in its "binary-caches" subdirectory. Thus, the URLS of the binary caches for the channels added by root appear in /nix/var/nix/profiles/per-user/eelco/channels/binary-caches/*. The binary cache substituter reads these and adds them to the list of binary caches.
2012-08-01 download-from-binary-cache: Remove duplicate URLsEelco Dolstra1-2/+2
2012-08-01 Report substituter errors to clients of the Nix daemonEelco Dolstra1-7/+3
2012-07-31 Allow daemon users to override ‘binary-caches’Eelco Dolstra1-3/+27
For security reasons, daemon users can only specify caches that appear in the ‘binary-caches’ and ‘trusted-binary-caches’ options in nix.conf.
2012-07-30 Do some validation of URLsEelco Dolstra1-2/+2
2012-07-30 Get rid of $NIX_BINARY_CACHESEelco Dolstra1-3/+2
You can use ‘--option binary-caches URLs’ instead.
2012-07-27 Allow a binary cache to declare that it doesn't support "nix-env -qas"Eelco Dolstra1-73/+101
Querying all substitutable paths via "nix-env -qas" is potentially hard on a server, since it involves sending thousands of HEAD requests. So a binary cache must now have a meta-info file named "nix-cache-info" that specifies whether the server wants this. It also specifies the store prefix so that we don't send useless queries to a binary cache for a different store prefix.
2012-07-27 Let build.cc verify the expected hash of a substituter's outputEelco Dolstra1-7/+4
Since SubstitutionGoal::finished() in build.cc computes the hash anyway, we can prevent the inefficiency of computing the hash twice by letting the substituter tell Nix about the expected hash, which can then verify it.
2012-07-27 download-using-manifests: Don't use nix-prefetch-urlEelco Dolstra1-1/+1
Instead call curl directly and pipe it into ‘nix-store --restore’. This saves I/O and prevents creating garbage in the Nix store.
2012-07-27 Remove trailing whitespace / tabsEelco Dolstra1-17/+17
2012-07-27 download-from-binary-cache: Only use the default cache for /nix/storeEelco Dolstra1-1/+3
2012-07-26 download-from-binary-cache: Support file://Eelco Dolstra1-9/+14
The file:// URI schema requires checking for errors in a more general way. Also, don't cache file:// lookups.
2012-07-18 download-from-binary-cache: Print correct URLEelco Dolstra1-2/+5
2012-07-17 Print some debug outputEelco Dolstra1-8/+15
2012-07-11 Set the User-Agent header to "Nix/<version>"Eelco Dolstra1-0/+1
2012-07-11 download-from-binary-cache: Use HEAD requests if possibleEelco Dolstra1-12/+79
In "nix-env -qas", we don't need the substitute info, we just need to know if it exists. This can be done using a HTTP HEAD request, which saves bandwidth. Note however that curl currently has a bug that prevents it from reusing HTTP connections if HEAD requests return a 404: https://sourceforge.net/tracker/?func=detail&aid=3542731&group_id=976&atid=100976 Without the patch attached to the issue, using HEAD is actually quite a bit slower than GET.
2012-07-11 CleanupEelco Dolstra1-3/+3
2012-07-09 download-from-binary-cache: add nix.conf optionsEelco Dolstra1-3/+7
2012-07-08 CleanupEelco Dolstra1-13/+13
2012-07-06 download-from-binary-cache: parallelise fetching of NAR info filesEelco Dolstra1-76/+128
Getting substitute information using the binary cache substituter has non-trivial latency overhead. A package or NixOS system configuration can have hundreds of dependencies, and in the worst case (when the local info cache is empty) we have to do a separate HTTP request for each of these. If the ping time to the server is t, getting N info files will take tN seconds; e.g., with a ping time of 0.1s to nixos.org, sequentially downloading 1000 info files (a typical NixOS config) will take at least 100 seconds. To fix this problem, the binary cache substituter can now perform requests in parallel. This required changing the substituter interface to support a function querySubstitutablePathInfos() that queries multiple paths at the same time, and rewriting queryMissing() to take advantage of parallelism. (Due to local caching, parallelising queryMissing() is sufficient for most use cases, since it's almost always called before building a derivation and thus fills the local info cache.) For example, parallelism speeds up querying all 1056 paths in a particular NixOS system configuration from 116s to 2.6s. It works so well because the eccentricity of the top-level derivation in the dependency graph is only 9. So we only need 10 round-trips (when using an unlimited number of parallel connections) to get everything. Currently we do a maximum of 150 parallel connections to the server. Thus it's important that the binary cache server (e.g. nixos.org) has a high connection limit. Alternatively we could use HTTP pipelining, but WWW::Curl doesn't support it and libcurl has a hard-coded limit of 5 requests per pipeline.
2012-07-06 download-from-binary-cache: use WWW::CurlEelco Dolstra1-11/+68
Using WWW::Curl rather than running an external curl process for every NAR info file halves the time it takes to get info thanks to libcurl's support for persistent HTTP connections. (We save a roundtrip per file.) But the real gain will come from using parallel and/or pipelined requests.
2012-07-03 download-from-binary-cache: do negative NAR info cachingEelco Dolstra1-5/+29
I.e. if a NAR info file does *not* exist, we record it in the cache DB so that we don't retry it later.
2012-07-03 download-from-binary-cache: in queries, preferred cached infoEelco Dolstra1-20/+28
2012-07-03 download-from-binary-cache: strip trailing / from URLsEelco Dolstra1-1/+1
2012-07-03 download-from-binary-cache: cache binary cache info in a SQLite DBEelco Dolstra1-8/+117
2012-07-02 download-from-binary-cache: Verify NAR hashesEelco Dolstra1-6/+15
2012-07-02 Binary caches: use a better keyEelco Dolstra1-5/+10
Use the hash part of the store path as a key rather than a hash of the store path. This is enough to get the desired privacy property.
2012-07-01 Add an environment variable $NIX_BINARY_CACHES specifying URLs of binary cachesEelco Dolstra1-2/+7
2012-07-01 Allow both bzip2 and xz compressionEelco Dolstra1-5/+14
2012-06-29 First attempt at the manifest-less substituterEelco Dolstra1-0/+118