about summary refs log tree commit diff
path: root/src/libstore/remote-store.cc
AgeCommit message (Collapse)AuthorFilesLines
2014-02-18 Add a flag ‘--check’ to verify build determinismEelco Dolstra1-2/+2
The flag ‘--check’ to ‘nix-store -r’ or ‘nix-build’ will cause Nix to redo the build of a derivation whose output paths are already valid. If the new output differs from the original output, an error is printed. This makes it easier to test if a build is deterministic. (Obviously this cannot catch all sources of non-determinism, but it catches the most common one, namely the current time.) For example: $ nix-build '<nixpkgs>' -A patchelf ... $ nix-build '<nixpkgs>' -A patchelf --check error: derivation `/nix/store/1ipvxsdnbhl1rw6siz6x92s7sc8nwkkb-patchelf-0.6' may not be deterministic: hash mismatch in output `/nix/store/4pc1dmw5xkwmc6q3gdc9i5nbjl4dkjpp-patchelf-0.6.drv' The --check build fails if not all outputs are valid. Thus the first call to nix-build is necessary to ensure that all outputs are valid. The current outputs are left untouched: the new outputs are either put in a chroot or diverted to a different location in the store using hash rewriting.
2013-09-06 Don't apply the CPU affinity hack to nix-shell (and other Perl programs)Eelco Dolstra1-1/+1
As discovered by Todd Veldhuizen, the shell started by nix-shell has its affinity set to a single CPU. This is because nix-shell connects to the Nix daemon, which causes the affinity hack to be applied. So we turn this off for Perl programs.
2013-08-07 Run the daemon worker on the same CPU as the clientEelco Dolstra1-1/+12
On a system with multiple CPUs, running Nix operations through the daemon is significantly slower than "direct" mode: $ NIX_REMOTE= nix-instantiate '<nixos>' -A system real 0m0.974s user 0m0.875s sys 0m0.088s $ NIX_REMOTE=daemon nix-instantiate '<nixos>' -A system real 0m2.118s user 0m1.463s sys 0m0.218s The main reason seems to be that the client and the worker get moved to a different CPU after every call to the worker. This patch adds a hack to lock them to the same CPU. With this, the overhead of going through the daemon is very small: $ NIX_REMOTE=daemon nix-instantiate '<nixos>' -A system real 0m1.074s user 0m0.809s sys 0m0.098s
2013-03-08 Revert "Prevent config.h from being clobbered"Eelco Dolstra1-1/+1
This reverts commit 28bba8c44f484eae38e8a15dcec73cfa999156f6.
2013-03-07 Prevent config.h from being clobberedEelco Dolstra1-1/+1
2013-02-19 Add `Settings::nixDaemonSocketFile'.Ludovic Courtès1-1/+1
2012-12-29 nix-build: Support talking to old daemonsEelco Dolstra1-1/+10
Fixes #76.
2012-12-20 nix-store -q --roots: Respect the gc-keep-outputs/gc-keep-derivations settingsEelco Dolstra1-0/+10
So if a path is not garbage solely because it's reachable from a root due to the gc-keep-outputs or gc-keep-derivations settings, ‘nix-store -q --roots’ now shows that root.
2012-11-15 Don't use std::cerr in a few placesEelco Dolstra1-1/+1
Slightly scared of using std::cerr in a vforked process...
2012-10-03 Drop support for running nix-worker in "slave" modeEelco Dolstra1-55/+3
AFAIK nobody uses this, setuid binaries are evil, and there is no good reason why people can't just run the daemon.
2012-10-03 Add a ‘--repair’ flag to nix-instantiateEelco Dolstra1-3/+7
This allows repairing corrupted derivations and other source files.
2012-10-02 Add a --repair flag to ‘nix-store -r’ to repair derivation outputsEelco Dolstra1-1/+2
With this flag, if any valid derivation output is missing or corrupt, it will be recreated by using a substitute if available, or by rebuilding the derivation. The latter may use hash rewriting if chroots are not available.
2012-09-13 RemoteStore::connectToDaemon(): Set close-on-exec flagEelco Dolstra1-0/+1
This ensures that "nix-build --run-env" doesn't keep a connection to the worker open, preventing it from exiting.
2012-08-27 Merge branch 'master' into no-manifestsEelco Dolstra1-1/+1
2012-08-01 Drop the block count in the garbage collectorEelco Dolstra1-1/+1
2012-07-31 Pass all --option flags to the daemonEelco Dolstra1-0/+10
2012-07-30 Refactor settings processingEelco Dolstra1-12/+12
Put all Nix configuration flags in a Settings object.
2012-07-30 WhitespaceEelco Dolstra1-21/+21
2012-07-18 Merge branch 'master' into no-manifestsEelco Dolstra1-0/+12
2012-07-17 Add function queryPathFromHashPart()Eelco Dolstra1-0/+12
To implement binary caches efficiently, Hydra needs to be able to map the hash part of a store path (e.g. "gbg...zr7") to the full store path (e.g. "/nix/store/gbg...kzr7-subversion-1.7.5"). (The binary cache mechanism uses hash parts as a key for looking up store paths to ensure privacy.) However, doing a search in the Nix store for /nix/store/<hash>* is expensive since it requires reading the entire directory. queryPathFromHashPart() prevents this by doing a cheap database lookup.
2012-07-11 Replace hasSubstitutes() with querySubstitutablePaths()Eelco Dolstra1-7/+17
querySubstitutablePaths() takes a set of paths, so this greatly reduces daemon <-> client latency.
2012-07-11 Add a function queryValidPaths()Eelco Dolstra1-0/+17
queryValidPaths() combines multiple calls to isValidPath() in one. This matters when using the Nix daemon because it reduces latency. For instance, on "nix-env -qas \*" it reduces execution time from 5.7s to 4.7s (which is indistinguishable from the non-daemon case).
2012-07-11 Rename queryValidPaths() to queryAllValidPaths()Eelco Dolstra1-2/+2
2012-07-11 Implement querySubstitutablePathInfos() in the daemonEelco Dolstra1-23/+37
Also removed querySubstitutablePathInfo().
2012-07-06 download-from-binary-cache: parallelise fetching of NAR info filesEelco Dolstra1-0/+13
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-06-27 nix-store -r: do substitutions in parallelEelco Dolstra1-2/+2
I.e. when multiple non-derivation arguments are passed to ‘nix-store -r’ to be substituted, do them in parallel.
2012-05-29 Reserve some disk space for the garbage collectorEelco Dolstra1-2/+4
We can't open a SQLite database if the disk is full. Since this prevents the garbage collector from running when it's most needed, we reserve some dummy space that we can free just before doing a garbage collection. This actually revives some old code from the Berkeley DB days. Fixes #27.
2012-04-30 * Add an option ‘build-use-substitutes’, which can be set to ‘false’Eelco Dolstra1-0/+3
to disable use of substitutes; i.e., force building from source. Fixes Nix/221.
2012-03-26 Remove the --max-links GC optionEelco Dolstra1-1/+1
We don't need this anymore now that current filesystems support more than 32,000 files in a directory.
2012-02-09 Use data() instead of c_str() where appropriateEelco Dolstra1-2/+2
2011-12-20 * Fix the build.Eelco Dolstra1-1/+1
2011-12-16 * Sync with the trunk.Eelco Dolstra1-23/+28
2011-12-16 * importPath() -> importPaths(). Because of buffering of the inputEelco Dolstra1-20/+21
stream it's now necessary for the daemon to process the entire sequence of exported paths, rather than letting the client do it.
2011-12-16 * Make the import operation through the daemon much more efficientEelco Dolstra1-3/+3
(way fewer roundtrips) by allowing the client to send data in bigger chunks. * Some refactoring.
2011-12-15 * Refactoring: move sink/source buffering into separate classes.Eelco Dolstra1-1/+1
* Buffer the HashSink. This speeds up hashing a bit because it prevents lots of calls to the hash update functions (e.g. nix-hash went from 9.3s to 8.7s of user time on the closure of my /var/run/current-system).
2011-12-14 * Buffer writes in FdSink. This significantly reduces the number ofEelco Dolstra1-0/+4
system calls / context switches when dumping a NAR and in the worker protocol.
2011-12-01 * When doing "nix-store --add-fixed" without "--recursive" via the NixEelco Dolstra1-1/+1
daemon (which is an error), print a nicer error message than "Connection reset by peer" or "broken pipe". * In the daemon, log errors that occur during request parameter processing.
2011-11-06 Include all outputs of derivations in the closure of explicitly-passed ↵Shea Levy1-0/+10
derivation paths This required adding a queryOutputDerivationNames function in the store API
2011-04-19 * Handle error messages from the Nix worker containing the `%'Eelco Dolstra1-1/+1
character. (Nix/216)
2010-12-17 * Propagate the "100" exit status for failed builds through the NixEelco Dolstra1-2/+5
daemon.
2010-11-17 * Before a build, show the disk space that the downloaded store pathsEelco Dolstra1-2/+2
will approximately require.
2010-11-17 * Implement RemoteStore::queryPathInfo().Eelco Dolstra1-1/+13
2010-11-16 * Store the size of a store path in the database (to be precise, theEelco Dolstra1-0/+6
size of the NAR serialisation of the path, i.e., `nix-store --dump PATH'). This is useful for Hydra.
2010-08-30 * When using the build hook, distinguish between the stderr of theEelco Dolstra1-8/+1
hook script proper, and the stdout/stderr of the builder. Only the latter should be saved in /nix/var/log/nix/drvs. * Allow the verbosity to be set through an option. * Added a flag --quiet to lower the verbosity level.
2010-08-24 * Sync with the trunk.Eelco Dolstra1-0/+3
2010-08-12 * Make --cores work when building through the Nix daemon.Eelco Dolstra1-0/+3
2010-08-04 * Sync with the trunk.Eelco Dolstra1-0/+2
2010-06-24 Include <cstring> to ensure that strcpy(), strlen(), and memset() are declared.Peter Simons1-0/+2
An "using namespace std" was added locally in those functions that refer to names from <cstring>. That is not pretty, but it's a very portable solution, because strcpy() and friends will be found in both the 'std' and in the global namespace.
2010-05-04 * Allow unprivileged users to do `nix-store --clear-failed-paths' andEelco Dolstra1-0/+19
`nix-store --query-failed-paths'.
2010-02-26 * Implement RemoteStore::queryValidPaths().Eelco Dolstra1-1/+3