about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2012-08-01 Drop the block count in the garbage collectorEelco Dolstra9-37/+23
2012-08-01 nix-store --gc: Make ‘--max-freed 0’ do the right thingEelco Dolstra4-7/+6
That is, delete almost nothing (it will still remove unused links from /nix/store/.links).
2012-08-01 removeUnusedLinks(): Print stats on disk space saved by hard linkingEelco Dolstra1-1/+16
2012-08-01 DohEelco Dolstra1-1/+2
2012-08-01 Make ‘nix-store --optimise’ interruptibleEelco Dolstra1-0/+2
2012-07-26 Set permissions on temporary build directories to 0700Eelco Dolstra3-4/+5
Fixes #39.
2012-07-25 prim_import: When importing .drvs, allocate the intermediate attrset on the ↵Shea Levy1-1/+1
heap just in case it escapes the stack frame.
2012-07-25 import: If the path is a valid .drv file, parse it and generate a derivation ↵Shea Levy1-1/+25
attrset. The generated attrset has drvPath and outPath with the right string context, type 'derivation', outputName with the right name, all with a list of outputs, and an attribute for each output. I see three uses for this (though certainly there may be more): * Using derivations generated by something besides nix-instantiate (e.g. guix) * Allowing packages provided by channels to be used in nix expressions. If a channel installed a valid deriver for each package it provides into the store, then those could be imported and used as dependencies or installed in environment.systemPackages, for example. * Enable hydra to be consistent in how it treats inputs that are outputs of another build. Right now, if an input is passed as an argument to the job, it is passed as a derivation, but if it is accessed via NIX_PATH (i.e. through the <> syntax), then it is a path that can be imported. This is problematic because the build being depended upon may have been built with non-obvious arguments passed to its jobset file. With this feature, hydra can just set the name of that input to the path to its drv file in NIX_PATH
2012-07-23 Handle platforms that don't support linking to a symlinkEelco Dolstra1-2/+7
E.g. Darwin doesn't allow this.
2012-07-23 Unlink the right fileEelco Dolstra1-2/+2
2012-07-23 Garbage collect unused links in /nix/store/.linksEelco Dolstra2-0/+39
Incremental optimisation requires creating links in /nix/store/.links to all files in the store. However, this means that if we delete a store path, no files are actually deleted because links in /nix/store/.links still exists. So we need to check /nix/store/.links for files with a link count of 1 and delete them.
2012-07-23 Automatically optimise the Nix store when a new path is addedEelco Dolstra4-9/+31
Auto-optimisation is enabled by default. It can be turned off by setting auto-optimise-store to false in nix.conf.
2012-07-23 optimiseStore(): Use a content-addressed file store in /nix/store/.linksEelco Dolstra3-115/+110
optimiseStore() now creates persistent, content-addressed hard links in /nix/store/.links. For instance, if it encounters a file P with hash H, it will create a hard link P' = /nix/store/.link/<H> to P if P' doesn't already exist; if P' exist, then P is replaced by a hard link to P'. This is better than the previous in-memory map, because it had the tendency to unnecessarily replace hard links with a hard link to whatever happened to be the first file with a given hash it encountered. It also allows on-the-fly, incremental optimisation.
2012-07-23 Use lutimes() if available to canonicalise the timestamp of symlinksEelco Dolstra1-9/+16
Also use utimes() instead of utime() if lutimes() is not available.
2012-07-18 Use "#pragma once" to prevent repeated header file inclusionEelco Dolstra31-162/+31
2012-07-17 Add function queryPathFromHashPart()Eelco Dolstra7-0/+55
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-17 Return an exit code of 100 for cached failed buildsEelco Dolstra1-0/+1
Exit code 100 should be returned for all permanent failures. This includes cached failures. Fixes #34.
2012-07-17 Remove dead codeEelco Dolstra2-13/+0
2012-07-17 Update Nix 1.1 release notesEelco Dolstra1-0/+3
2012-07-17 Allow disabling log compressionEelco Dolstra1-12/+25
2012-07-12 builtins.storePath: resolve symlinksEelco Dolstra1-1/+5
Needed for Charon/Hydra interaction.
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 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-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.
2012-05-29 Add option ‘build-keep-log’ to enable/disable writing of build logsEelco Dolstra1-1/+4
Fixes #26.
2012-04-30 * Add an option ‘build-use-substitutes’, which can be set to ‘false’Eelco Dolstra5-4/+14
to disable use of substitutes; i.e., force building from source. Fixes Nix/221.
2012-04-30 Handle EPERM when creating a hard link for the chrootEelco Dolstra1-2/+5
There is a race condition when doing parallel builds with chroots and the immutable bit enabled. One process may call makeImmutable() before the other has called link(), in which case link() will fail with EPERM. We could retry or wrap the operation in a lock, but since this condition is rare and I'm lazy, we just use the existing copy fallback. Fixes #9.
2012-04-23 Merge pull request #2 from viric/masterEelco Dolstra1-0/+6
Again, adding the sync option
2012-04-17 nix-instantiate: default to "default.nix" if no arguments are givenEelco Dolstra1-1/+2
2012-04-17 Added utility command ‘nix-instantiate --find-file’ to look up a file in ↵Eelco Dolstra1-0/+12
Nix's search path
2012-04-16 Fix obscure race condition in GC root creationEelco Dolstra1-16/+18
This should fix rare Hydra errors of the form: error: symlinking `/nix/var/nix/gcroots/per-user/hydra/hydra-roots/7sfhs5fdmjxm8sqgcpd0pgcsmz1kq0l0-nixos-iso-0.1pre33785-33795' to `/nix/store/7sfhs5fdmjxm8sqgcpd0pgcsmz1kq0l0-nixos-iso-0.1pre33785-33795': File exists
2012-04-15 Set a few more close-on-exec flagsEelco Dolstra1-0/+4
2012-04-15 Close almost all file descriptors in the builderEelco Dolstra1-0/+3
This regression was accidentally introduced in 35355fc1fcffbe859395e360c0a6a1463f137d63.
2012-04-14 Remove unnecessary "system" argumentEelco Dolstra1-1/+0
2012-04-13 Use Bison 2.5Eelco Dolstra1-0/+2
2012-04-05 On Linux, pretend we're building on Linux 2.6Eelco Dolstra1-0/+11
Setting the UNAME26 personality causes "uname" to return "2.6.x", regardless of the kernel version. This improves determinism in a few misbehaved packages.
2012-04-04 Include --keep-going in --helpEelco Dolstra2-0/+4
2012-03-26 Mac OS X fixEelco Dolstra1-0/+3
2012-03-26 Delete non-directory valid paths right awayEelco Dolstra1-16/+27
It's unlikely that rename() is faster than unlink() on a regular file or symlink, so don't bother.
2012-03-26 Make the garbage collector more concurrentEelco Dolstra3-21/+48
Make the garbage collector more concurrent by deleting valid paths outside the region where we're holding the global GC lock. This should greatly reduce the time during which new builds are blocked, since the deletion accounts for the vast majority of the time spent in the GC. To ensure that this is safe, the valid paths are invalidated and renamed to some arbitrary path while we're holding the lock. This ensures that we when we finally delete the path, it's not a (newly) valid or locked path.
2012-03-26 Remove the --max-links GC optionEelco Dolstra6-19/+3
We don't need this anymore now that current filesystems support more than 32,000 files in a directory.