aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2013-09-17RestoreSink: Slightly reduce the number of concurrent FDsEelco Dolstra
2013-09-06Remove stray debug lineEelco Dolstra
2013-09-06Don't apply the CPU affinity hack to nix-shell (and other Perl programs)Eelco Dolstra
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-09-03nix-env -i: Add a flag ‘--remove-all’ / ‘-r’Eelco Dolstra
This is equivalent to running ‘nix-env -e '*'’ first, except that it happens in a single transaction. Thus, ‘nix-env -i pkgs...’ replaces the profile with the specified set of packages. The main motivation is to support declarative package management (similar to environment.systemPackages in NixOS). That is, if you have a specification ‘profile.nix’ like this: with import <nixpkgs> {}; [ thunderbird geeqie ... ] then after any change to ‘profile.nix’, you can run: $ nix-env -f profile.nix -ir to update the profile to match the specification. (Without the ‘-r’ flag, if you remove a package from ‘profile.nix’, it won't be removed from the actual profile.) Suggested by @zefhemel.
2013-09-03nix-env: Use wildcard match by defaultEelco Dolstra
That is, you don't need to pass '*' anymore, so nix-env -qa is equivalent to nix-env -qa '*'
2013-09-03nix-env: Load files in ~/.nix-defexpr on demandEelco Dolstra
So if you do "nix-env -qa -A nixos", then other channels won't be parsed/evaluated at all.
2013-09-03Check for name collisions in the input Nix expressionsEelco Dolstra
2013-09-03Work on Values instead of ExprsEelco Dolstra
This prevents some duplicate evaluation in nix-env and nix-instantiate. Also, when traversing ~/.nix-defexpr, only read regular files with the extension .nix. Previously it was reading files like .../channels/binary-caches/<name>. The only reason this didn't cause problems is pure luck (namely, <name> shadows an actual Nix expression, the binary-caches files happen to be syntactically valid Nix expressions, and we iterate over the directory contents in just the right order).
2013-09-03ReformatEelco Dolstra
2013-09-03Get rid of the parse tree cacheEelco Dolstra
Since we already cache files in normal form (fileEvalCache), caching parse trees is redundant. Note that getting rid of this cache doesn't actually save much memory at the moment, because parse trees are currently not freed / GC'ed.
2013-09-02Add some support code for nix-replEelco Dolstra
2013-09-02Get rid of a signedness warningEelco Dolstra
2013-09-02Fix whitespaceEelco Dolstra
2013-09-02Only show trace messages when tracing is enabledEelco Dolstra
2013-09-02Add an option to limit the log output of buildersEelco Dolstra
This is mostly useful for Hydra to deal with builders that get stuck in an infinite loop writing data to stdout/stderr.
2013-08-26Simplify inherited attribute handlingShea Levy
This reduces the difference between inherited and non-inherited attribute handling to the choice of which env to use (in recs and lets) by setting the AttrDef::e to a new ExprVar in the parser rather than carrying a separate AttrDef::v VarRef member. As an added bonus, this allows inherited attributes that inherit from a with to delay forcing evaluation of the with's attributes. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-08-26Fix typos, especially those that end up in the Nix manualIvan Kozik
2013-08-26Fix personality switching from x86_64 to i686Gergely Risko
On Linux, Nix can build i686 packages even on x86_64 systems. It's not enough to recognize this situation by settings.thisSystem, we also have to consult uname(). E.g. we can be running on a i686 Debian with an amd64 kernel. In that situation settings.thisSystem is i686-linux, but we still need to change personality to i686 to make builds consistent.
2013-08-19Store Nix integers as longsEelco Dolstra
So on 64-bit systems, integers are now 64-bit. Fixes #158.
2013-08-14TypoEelco Dolstra
2013-08-07Respect MINSIGSTKSZ when allocating an alternative stackEelco Dolstra
http://hydra.nixos.org/build/5663577
2013-08-07Fix build on non-LinuxEelco Dolstra
http://hydra.nixos.org/build/5662914
2013-08-07Run the daemon worker on the same CPU as the clientEelco Dolstra
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-08-06Remove obsolete reference to ATermsEelco Dolstra
2013-08-02In the profiler output, show function names (if available)Eelco Dolstra
2013-08-02Let the ordering operators also work on stringsEelco Dolstra
E.g. ‘"foo" < "bar"’ now works.
2013-08-02Add comparison operators ‘<’, ‘<=’, ‘>’ and ‘>=’Eelco Dolstra
2013-08-02Add integer ‘-’, ‘*’ and ‘/’ operatorsEelco Dolstra
2013-08-02Add a unary integer negation operatorEelco Dolstra
This allows saying "-1" instead of "builtins.sub 0 1".
2013-08-02Overload the ‘+’ operator to support integer additionEelco Dolstra
2013-07-31Make Env smallerEelco Dolstra
Commit 20866a7031ca823055a221653b77986faa167329 added a ‘withAttrs’ field to Env, which is annoying because it makes every Env structure bigger and we allocate millions of them. E.g. NixOS evaluation took 18 MiB more. So this commit squeezes ‘withAttrs’ into values[0]. Probably should use a union...
2013-07-31Don't use NULLEelco Dolstra
2013-07-31Avoid thunks when a fromWith var can be looked up without evaluationShea Levy
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-31Delay evaulation of `with` attrs until a variable lookup needs themShea Levy
Evaluation of attribute sets is strict in the attribute names, which means immediate evaluation of `with` attribute sets rules out some potentially interesting use cases (e.g. where the attribute names of one set depend in some way on another but we want to bring those names into scope for some values in the second set). The major example of this is overridable self-referential package sets (e.g. all-packages.nix). With immediate `with` evaluation, the only options for such sets are to either make them non-recursive and explicitly use the name of the overridden set in non-overridden one every time you want to reference another package, or make the set recursive and use the `__overrides` hack. As shown in the test case that comes with this commit, though, delayed `with` evaluation allows a nicer third alternative. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-30Detect stack overflowsEelco Dolstra
Previously, if the Nix evaluator gets a stack overflow due to a deep or infinite recursion in the Nix expression, the user gets an unhelpful message ("Segmentation fault") that doesn't indicate that the problem is in the user's code rather than Nix itself. Now it prints: error: stack overflow (possible infinite recursion) This only works on x86_64-linux and i686-linux. Fixes #35.
2013-07-30killUser: Don't let the child kill itself on AppleShea Levy
The kill(2) in Apple's libc follows POSIX semantics, which means that kill(-1, SIGKILL) will kill the calling process too. Since nix has no way to distinguish between the process successfully killing everything and the process being killed by a rogue builder in that case, it can't safely conclude that killUser was successful. Luckily, the actual kill syscall takes a parameter that determines whether POSIX semantics are followed, so we can call that syscall directly and avoid the issue on Apple. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-18Revert "build-remote.pl: Enforce timeouts locally"Eelco Dolstra
This reverts commit 69b8f9980f39c14a59365a188b300a34d625a2cd. The timeout should be enforced remotely. Otherwise, if the garbage collector is running either locally or remotely, if will block the build or closure copying for some time. If the garbage collector takes too long, the build may time out, which is not what we want. Also, on heavily loaded systems, copying large paths to and from the remote machine can take a long time, also potentially resulting in a timeout.
2013-07-15Allow bind-mounting regular files into the chrootShea Levy
mount(2) with MS_BIND allows mounting a regular file on top of a regular file, so there's no reason to only bind directories. This allows finer control over just which files are and aren't included in the chroot without having to build symlink trees or the like. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-12Garbage collector: Don't follow symlinks arbitrarilyEelco Dolstra
Only indirect roots (symlinks to symlinks to the Nix store) are now supported.
2013-07-07Leave `HAVE_HUP_NOTIFICATION' undefined on GNU/Hurd.Ludovic Courtès
2013-06-20Don't set $preferLocalBuild and $requiredSystemFeatures in buildersEelco Dolstra
With C++ std::map, doing a comparison like ‘map["foo"] == ...’ has the side-effect of adding a mapping from "foo" to the empty string if "foo" doesn't exist in the map. So we ended up setting some environment variables by accident.
2013-06-20Don't substitute derivations that have preferLocalBuild setEelco Dolstra
In particular this means that "trivial" derivations such as writeText are not substituted, reducing the number of GET requests to the binary cache by about 200 on a typical NixOS configuration.
2013-06-20Increase SQLite's auto-checkpoint intervalEelco Dolstra
Common operations like instantiating a NixOS system config no longer fitted in 8192 pages, leading to more fsyncs. So increase this limit.
2013-06-20Disable the copy-from-other-stores substituterEelco Dolstra
This substituter basically cannot work reliably since we switched to SQLite, since SQLite databases may need write access to open them even just for reading (and in WAL mode they always do).
2013-06-20Don't keep "disabled" substituters runningEelco Dolstra
For instance, it's pointless to keep copy-from-other-stores running if there are no other stores, or download-using-manifests if there are no manifests. This also speeds things up because we don't send queries to those substituters.
2013-06-13Allow hard links between the outputs of a derivationEelco Dolstra
2013-06-13Fix a security bug in hash rewritingEelco Dolstra
Before calling dumpPath(), we have to make sure the files are owned by the build user. Otherwise, the build could contain a hard link to (say) /etc/shadow, which would then be read by the daemon and rewritten as a world-readable file. This only affects systems that don't have hard link restrictions enabled.
2013-06-13Fix assertion failure in canonicalisePathMetaData() after hash rewritingEelco Dolstra
The assertion in canonicalisePathMetaData() failed because the ownership of the path already changed due to the hash rewriting. The solution is not to check the ownership of rewritten paths. Issue #122.
2013-06-13computeFSClosure: Only process the missing/corrupt pathsEelco Dolstra
Issue #122.
2013-06-13In repair mode, update the hash of rebuilt pathsEelco Dolstra
Otherwise subsequent invocations of "--repair" will keep rebuilding the path. This only happens if the path content differs between builds (e.g. due to timestamps).