about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorFilesLines
2012-07-11 Set the User-Agent header to "Nix/<version>"Eelco Dolstra2-0/+3
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 Replace hasSubstitutes() with querySubstitutablePaths()Eelco Dolstra8-24/+52
querySubstitutablePaths() takes a set of paths, so this greatly reduces daemon <-> client latency.
2012-07-11 Add a function queryValidPaths()Eelco Dolstra8-3/+49
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 Dolstra9-17/+17
2012-07-11 Implement querySubstitutablePathInfos() in the daemonEelco Dolstra7-55/+70
Also removed querySubstitutablePathInfo().
2012-07-11 nix-env: Determine which paths have substitutes in parallelEelco Dolstra2-2/+24
2012-07-11 CleanupEelco Dolstra1-3/+3
2012-07-09 Add WWW::Curl as a dependencyEelco Dolstra2-0/+14
2012-07-09 download-from-binary-cache: add nix.conf optionsEelco Dolstra3-6/+30
2012-07-09 prim_import(): prefetch substitute info in parallel using queryMissing()Eelco Dolstra1-0/+6
2012-07-08 build.cc: Don't use hasSubstitute()Eelco Dolstra1-11/+25
Instead make a single call to querySubstitutablePathInfo() per derivation output. This is faster and prevents having to implement the "have" function in the binary cache substituter.
2012-07-08 CleanupEelco Dolstra1-13/+13
2012-07-06 download-from-binary-cache: parallelise fetching of NAR info filesEelco Dolstra9-131/+282
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 nix-push: Always generate base-32 hashesEelco Dolstra2-4/+4
2012-07-02 Binary caches: use a better keyEelco Dolstra2-8/+13
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 Fix xz compressionEelco Dolstra1-3/+3
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 Dolstra3-30/+68
2012-06-29 nix-push: Don't pollute the current directory with result symlinkEelco Dolstra1-1/+1
2012-06-29 First attempt at the manifest-less substituterEelco Dolstra4-5/+123
2012-06-29 DohEelco Dolstra1-1/+1
2012-06-29 Use XZ compression in binary cachesEelco Dolstra6-19/+24
XZ compresses significantly better than bzip2. Here are the compression ratios and execution times (using 4 cores in parallel) on my /var/run/current-system (3.1 GiB): bzip2: total compressed size 849.56 MiB, 30.8% [2m08] xz -6: total compressed size 641.84 MiB, 23.4% [6m53] xz -7: total compressed size 621.82 MiB, 22.6% [7m19] xz -8: total compressed size 599.33 MiB, 21.8% [7m18] xz -9: total compressed size 588.18 MiB, 21.4% [7m40] Note that compression takes much longer. More importantly, however, decompression is much faster: bzip2: 1m47.274s xz -6: 0m55.446s xz -7: 0m54.119s xz -8: 0m52.388s xz -9: 0m51.842s The only downside to using -9 is that decompression takes a fair amount (~65 MB) of memory.
2012-06-28 nix-push: create a manifest-less binary cacheEelco Dolstra1-159/+93
Manifests are a huge pain, since users need to run nix-pull directly or indirectly to obtain them. They tend to be large and lag behind the available binaries; also, the downloaded manifests in /nix/var/nix/manifest need to be in sync with the Nixpkgs sources. So we want to get rid of them. The idea of manifest-free operation works as follows. Nix is configured with a set of URIs of binary caches, e.g. http://nixos.org/binary-cache Whenever Nix needs a store path X, it checks each binary cache for the existence of a file <CACHE-URI>/<SHA-256 hash of X>.narinfo, e.g. http://nixos.org/binary-cache/bi1gh9...ia17.narinfo The .narinfo file contains the necessary information about the store path that was formerly kept in the manifest, i.e., (relative) URI of the compressed NAR, references, size, hash, etc. For example: StorePath: /nix/store/xqp4l88cr9bxv01jinkz861mnc9p7qfi-neon-0.29.6 URL: 1bjxbg52l32wj8ww47sw9f4qz0r8n5vs71l93lcbgk2506v3cpfd.nar.bz2 CompressedHash: sha256:1bjxbg52l32wj8ww47sw9f4qz0r8n5vs71l93lcbgk2506v3cpfd CompressedSize: 202542 NarHash: sha256:1af26536781e6134ab84201b33408759fc59b36cc5530f57c0663f67b588e15f NarSize: 700440 References: 043zrsanirjh8nbc5vqpjn93hhrf107f-bash-4.2-p24 cj7a81wsm1ijwwpkks3725661h3263p5-glibc-2.13 ... Deriver: 4idz1bgi58h3pazxr3akrw4fsr6zrf3r-neon-0.29.6.drv System: x86_64-linux Nix then knows that it needs to download http://nixos.org/binary-cache/1bjxbg52l32wj8ww47sw9f4qz0r8n5vs71l93lcbgk2506v3cpfd.nar.bz2 to substitute the store path. Note that the store directory is omitted from the References and Deriver fields to save space, and that the URL can be relative to the binary cache prefix. This patch just makes nix-push create binary caches in this format. The next step is to make a substituter that supports them.
2012-06-27 nix-store -r: do substitutions in parallelEelco Dolstra11-25/+30
I.e. when multiple non-derivation arguments are passed to ‘nix-store -r’ to be substituted, do them in parallel.
2012-06-27 Mount an empty /dev/shm tmpfs in the chrootEelco Dolstra1-0/+6
This ensures that whatever the builder writes in /dev/shm is automatically cleaned up.
2012-06-27 Check the return code of the clone() callEelco Dolstra1-1/+2
2012-06-25 When using chroots, use a private PID namespaceEelco Dolstra2-156/+186
In a private PID namespace, processes have PIDs that are separate from the rest of the system. The initial child gets PID 1. Processes in the chroot cannot see processes outside of the chroot. This improves isolation between builds. However, processes on the outside can see processes in the chroot and send signals to them (if they have appropriate rights). Since the builder gets PID 1, it serves as the reaper for zombies in the chroot. This might turn out to be a problem. In that case we'll need to have a small PID 1 process that sits in a loop calling wait().
2012-06-25 Use a private UTS namespace to provide a deterministic host/domain name to ↵Eelco Dolstra1-1/+7
builders In chroot builds, set the host name to "localhost" and the domain name to "(none)" (the latter being the kernel's default). This improves determinism a bit further. P.S. I have to idea what UTS stands for.
2012-06-23 Update release notesEelco Dolstra1-1/+15
2012-06-23 Improve error messageEelco Dolstra1-1/+1
2012-06-23 In chroot builds, use a private SysV IPC namespaceEelco Dolstra1-12/+19
This improves isolation a bit further, and it's just one extra flag in the unshare() call. P.S. It would be very cool to use CLONE_NEWPID (to put the builder in a private PID namespace) as well, but that's slightly more risky since having a builder start as PID 1 may cause problems.
2012-06-23 In chroot builds, use a private network namespaceEelco Dolstra1-6/+31
On Linux it's possible to run a process in its own network namespace, meaning that it gets its own set of network interfaces, disjunct from the rest of the system. We use this to completely remove network access to chroot builds, except that they get a private loopback interface. This means that: - Builders cannot connect to the outside network or to other processes on the same machine, except processes within the same build. - Vice versa, other processes cannot connect to processes in a chroot build, and open ports/connections do not show up in "netstat". - If two concurrent builders try to listen on the same port (e.g. as part of a test), they no longer conflict with each other. This was inspired by the "PrivateNetwork" flag in systemd.
2012-06-18 Support socket-based, on-demand activation of the Nix daemon with systemdEelco Dolstra1-30/+46
Systemd can start the Nix daemon on demand when the Nix daemon socket is first accessed. This is signalled through the LISTEN_FDS environment variable, so all we need to do is check for that and then use file descriptor 3 as the listen socket instead of creating one ourselves.
2012-05-31 Add Emacs to the disk imageEelco Dolstra1-1/+1
2012-05-31 fixes to nix-worker systemd service descriptor: - remove commented-out lines ↵Michel Alexandre Salim2-3/+1
- register the file for distribution in Makefile.am
2012-05-31 On systems with SystemD, install the service descriptor for nix-worker, and ↵Michel Alexandre Salim2-0/+28
enable and start it
2012-05-31 Major spec update: - Fix license field - Split into subpackages - Update ↵Michel Alexandre Salim1-46/+149
build dependencies - Configure users and groups for multi-user mode - Fix installation location of Perl modules
2012-05-31 Update nix profile: - incorporate NixOS's configuration so that nix is ↵Michel Alexandre Salim2-8/+47
usable by normal users - install as a data file, not a program file
2012-05-31 - only enable deprecated spec sections when building on systems with older ↵Michel Alexandre Salim1-6/+12
RPM versions - move tests to dedicated %check section - use standard build macros
2012-05-31 - replace %define with %globalMichel Alexandre Salim1-5/+5
2012-05-30 Compress build logs on the fly using bzip2Eelco Dolstra2-11/+45
2012-05-30 "nix-store -l": support compressed logsEelco Dolstra2-9/+34
2012-05-29 Reserve some disk space for the garbage collectorEelco Dolstra9-11/+35
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.