about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2012-10-03 When ‘--help’ is given, just run ‘man’ to show the manual pageEelco Dolstra17-240/+23
I.e. do what git does. I'm too lazy to keep the builtin help text up to date :-) Also add ‘--help’ to various commands that lacked it (e.g. nix-collect-garbage).
2012-10-03 nix-env: Support ‘--repair’ flagEelco Dolstra3-5/+9
2012-10-03 Add a ‘--repair’ flag to nix-instantiateEelco Dolstra11-25/+36
This allows repairing corrupted derivations and other source files.
2012-10-03 Handle repairing paths that are in build-chroot-dirsEelco Dolstra1-0/+7
2012-10-03 When repairing a derivation, check and repair the entire output closureEelco Dolstra3-6/+91
If we find a corrupted path in the output closure, we rebuild the derivation that produced that particular path.
2012-10-02 Add a --repair flag to ‘nix-store -r’ to repair derivation outputsEelco Dolstra7-64/+116
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-10-02 nix-store -r: Get rid of an unnecessary call to buildPaths/ensurePathsEelco Dolstra1-4/+4
2012-10-02 nix-store --verify: Add an option ‘--repair’ to repair all ↵Eelco Dolstra3-10/+30
missing/corrupt paths Also, return a non-zero exit code if errors remain after verifying/repairing.
2012-10-02 Add operation ‘nix-store --repair-path’Eelco Dolstra3-28/+88
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-28 Handle octal escapes in /proc/self/mountinfoEelco Dolstra3-2/+24
2012-09-28 Print a more descriptive error message if setting up the build environment failsEelco Dolstra1-3/+14
2012-09-27 Allow dashes in identifiersEelco Dolstra1-1/+1
In Nixpkgs, the attribute in all-packages.nix corresponding to a package is usually equal to the package name. However, this doesn't work if the package contains a dash, which is fairly common. The convention is to replace the dash with an underscore (e.g. "dbus-lib" becomes "dbus_glib"), but that's annoying. So now dashes are valid in variable / attribute names, allowing you to write: dbus-glib = callPackage ../development/libraries/dbus-glib { }; and buildInputs = [ dbus-glib ]; Since we don't have a negation or subtraction operation in Nix, this is unambiguous.
2012-09-25 Make the store writable before creating /nix/store/.linksEelco Dolstra1-2/+1
2012-09-25 Merge branch 'readonly-store'Eelco Dolstra14-135/+106
2012-09-25 Include <sys/types.h> for off_tEelco Dolstra1-0/+1
Reported by "gio" on IRC.
2012-09-19 Remove setting of the immutable bitEelco Dolstra5-96/+35
Using the immutable bit is problematic, especially in conjunction with store optimisation. For instance, if the garbage collector deletes a file, it has to clear its immutable bit, but if the file has additional hard links, we can't set the bit afterwards because we don't know the remaining paths. So now that we support having the entire Nix store as a read-only mount, we may as well drop the immutable bit. Unfortunately, we have to keep the code to clear the immutable bit for backwards compatibility.
2012-09-19 Support having /nix/store as a read-only bind mountEelco Dolstra2-0/+41
It turns out that the immutable bit doesn't work all that well. A better way is to make the entire Nix store a read-only bind mount, i.e. by doing $ mount --bind /nix/store /nix/store $ mount -o remount,ro,bind /nix/store (This would typically done in an early boot script, before anything from /nix/store is used.) Since Nix needs to be able to write to the Nix store, it now detects if /nix/store is a read-only bind mount and then makes it writable in a private mount namespace.
2012-09-19 Templatise tokenizeString()Eelco Dolstra10-39/+30
2012-09-18 Keep build directory if not all expected outputs were producedEelco Dolstra1-3/+3
Fixes issue #123 in Nixpkgs.
2012-09-13 nix-env --delete-generations: Support --dry-run flagEelco Dolstra1-5/+10
Fixes #43.
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-09-13 Vacuum the SQLite DB after running the garbage collectorEelco Dolstra3-0/+12
2012-09-13 Delete paths in a component in topologically sorted orderEelco Dolstra1-1/+3
The outputs of a derivation can refer to each other (even though they cannot have cycles), so they have to be deleted in the right order. http://hydra.nixos.org/build/3026118
2012-09-13 Disable auto store optimisation for nowEelco Dolstra1-1/+1
I've seen operations like "nix-store --import" take much longer on one system. So default to off until I've investigated this a bit further.
2012-09-13 In startBuilder(), only print the new paths we're buildingEelco Dolstra1-2/+3
2012-09-12 Handle gc-keep-outputs and gc-keep-derivations both enabledEelco Dolstra1-94/+97
If the options gc-keep-outputs and gc-keep-derivations are both enabled, you can get a cycle in the liveness graph. There was a hack to handle this, but it didn't work with multiple-output derivations, causing the garbage collector to fail with errors like ‘error: cannot delete path `...' because it is in use by `...'’. The garbage collector now handles strongly connected components in the liveness graph as a unit and decides whether to delete all or none of the paths in an SCC.
2012-09-12 Build hook: Pass the timeout to the remote builderEelco Dolstra1-1/+1
Note that this will only work if the client has a very recent Nix version (post 15e1b2c223494ecb5efefc3ea0e3b926a6b1d7dc), otherwise the --option flag will just be ignored. Fixes #50.
2012-09-11 Fix "non-zero padding" errorEelco Dolstra1-1/+2
Probably it's not a good idea to pass a temporary object to StringSource.
2012-09-11 Support building a derivation if some outputs are already valid (non-chroot ↵Eelco Dolstra1-11/+67
case) This uses scary hash rewriting. Fixes #21.
2012-09-11 Remove debug lineEelco Dolstra1-3/+1
2012-09-11 Support building a derivation if some outputs are already validEelco Dolstra1-12/+16
This handles the chroot and build hook cases, which are easy. Supporting the non-chroot-build case will require more work (hash rewriting!). Issue #21.
2012-09-11 Include config.h before any other headerEelco Dolstra2-2/+4
"config.h" must be included first, because otherwise the compiler might not see the right value of _FILE_OFFSET_BITS. We've had this before; see 705868a8a96a10f70e629433cfffc2d5cd2703eb. In this case, GCC would compute a different address for ‘settings.useSubstitutes’ in misc.cc because of the off_t in ‘settings’. Reverts 3854fc9b42d16b810f62b64194b699033b03aaf1. http://hydra.nixos.org/build/3016700
2012-08-28 Make "nix-instantiate -" interruptibleEelco Dolstra1-3/+1
2012-08-27 Fix stupid type error in calling std::maxEelco Dolstra1-1/+1
2012-08-27 Merge branch 'master' into no-manifestsEelco Dolstra19-133/+319
2012-08-24 Include the output name in the GC root linkEelco Dolstra4-17/+12
Output names are now appended to resulting GC symlinks, e.g. by nix-build. For backwards compatibility, if the output is named "out", nothing is appended. E.g. doing "nix-build -A foo" on a derivation that produces outputs "out", "bin" and "dev" will produce symlinks "./result", "./result-bin" and "./result-dev", respectively.
2012-08-22 Receive reserveSpace before calling startWork()Eelco Dolstra1-4/+4
Otherwise we can get a SIGPOLL. Reported by Ludovic.
2012-08-20 Check if MS_PRIVATE is definedEelco Dolstra1-1/+1
http://hydra.nixos.org/build/2955671
2012-08-20 In the chroot, make all mounted filesystems privateEelco Dolstra3-3/+21
This is required on systemd, which mounts filesystems as "shared" subtrees. Changes to shared trees in a private mount namespace are propagated to the outside world, which is bad.
2012-08-20 Don't bind-mount /proc since we mount our ownEelco Dolstra1-2/+2
2012-08-19 Fix 1755 permission on temporary directories left behind by ‘-K’Eelco Dolstra1-4/+4
2012-08-13 Avoid concatenating lists of one stringEelco Dolstra2-2/+2
2012-08-13 Don't allocate empty listsEelco Dolstra1-1/+1
This saves about 4 MB when evaluating a NixOS system configuration.
2012-08-13 Optimise concatenating a list to an empty listEelco Dolstra1-2/+10
More precisely, in concatLists, if all lists except one are empty, then just return the non-empty list. This reduces the number of list element allocations by 32% when evaluating a NixOS system configuration.
2012-08-13 Add a primop ‘elemAt’ to get an element from a listEelco Dolstra1-5/+19
2012-08-13 Add a primop ‘concatLists’Eelco Dolstra3-8/+33
This can serve as a generic efficient list builder. For instance, the function ‘catAttrs’ in Nixpkgs can be rewritten from attr: l: fold (s: l: if hasAttr attr s then [(getAttr attr s)] ++ l else l) [] l to attr: l: builtins.concatLists (map (s: if hasAttr attr s then [(getAttr attr s)] else []) l) Statistics before: time elapsed: 1.08683 size of a value: 24 environments allocated: 1384376 (35809568 bytes) list elements: 6946783 (55574264 bytes) list concatenations: 37434 values allocated: 1760440 (42250560 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18273 number of thunks: 1297673 number of thunks avoided: 1380759 number of attr lookups: 430802 number of primop calls: 628912 number of function calls: 1333544 Statistics after (including new catAttrs): time elapsed: 0.959854 size of a value: 24 environments allocated: 1010198 (26829296 bytes) list elements: 1984878 (15879024 bytes) list concatenations: 30488 values allocated: 1589760 (38154240 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18274 number of thunks: 1040925 number of thunks avoided: 1038428 number of attr lookups: 438419 number of primop calls: 474844 number of function calls: 959366
2012-08-13 Provide an efficient implementation of ‘elem’Eelco Dolstra1-2/+17
The one in Nixpkgs is O(n^2), this one is O(n). Big reduction in the number of list allocations. Statistics before (on a NixOS system config): time elapsed: 1.17982 size of a value: 24 environments allocated: 1543334 (39624560 bytes) list elements: 9612638 (76901104 bytes) list concatenations: 37434 values allocated: 1854933 (44518392 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18272 number of thunks: 1392467 number of thunks avoided: 1507311 number of attr lookups: 430801 number of primop calls: 691600 number of function calls: 1492502 Statistics after: time elapsed: 1.08683 size of a value: 24 environments allocated: 1384376 (35809568 bytes) list elements: 6946783 (55574264 bytes) list concatenations: 37434 values allocated: 1760440 (42250560 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18273 number of thunks: 1297673 number of thunks avoided: 1380759 number of attr lookups: 430802 number of primop calls: 628912 number of function calls: 1333544
2012-08-13 Add a "filter" primopEelco Dolstra2-1/+26
Evaluation of a NixOS configuration spends quite a lot of time in the "filter" function in Nixpkgs. As implemented in Nixpkgs, this is a O(n^2) operation, so it's a good candidate for providing a more efficient (i.e. primop) implementation. Using it gives a ~10% speed increase and a significant reduction in the number of evaluations. Statistics before (on a NixOS system config): time elapsed: 1.3258 size of a value: 24 environments allocated: 1980939 (50127080 bytes) list elements: 14679308 (117434464 bytes) list concatenations: 50828 values allocated: 2098938 (50374512 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18271 number of thunks: 1645752 number of thunks avoided: 1921196 number of attr lookups: 430798 number of primop calls: 838807 number of function calls: 1930107 Statistics after: time elapsed: 1.17982 size of a value: 24 environments allocated: 1543334 (39624560 bytes) list elements: 9612638 (76901104 bytes) list concatenations: 37434 values allocated: 1854933 (44518392 bytes) attribute sets allocated: 392040 right-biased unions: 186334 values copied in right-biased unions: 591137 symbols in symbol table: 18272 number of thunks: 1392467 number of thunks avoided: 1507311 number of attr lookups: 430801 number of primop calls: 691600 number of function calls: 1492502
2012-08-12 Add some more evaluations statsEelco Dolstra2-1/+12
2012-08-12 Add some basic profiling support to the evaluatorEelco Dolstra5-4/+65
Setting the environment variable NIX_COUNT_CALLS to 1 enables some basic profiling in the evaluator. It will count calls to functions and primops as well as evaluations of attributes. For example, to see where evaluation of a NixOS configuration spends its time: $ NIX_SHOW_STATS=1 NIX_COUNT_CALLS=1 ./src/nix-instantiate/nix-instantiate '<nixos>' -A system --readonly-mode ... calls to 39 primops: 239532 head 233962 tail 191252 hasAttr ... calls to 1595 functions: 224157 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:19' 221767 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:14' 221767 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/lists.nix:17:10' ... evaluations of 7088 attributes: 167377 undefined position 132459 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/attrsets.nix:119:41' 47322 `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/pkgs/lib/attrsets.nix:13:21' ...