about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
AgeCommit message (Collapse)AuthorFilesLines
2010-04-15 * Store lists as lists of pointers to values rather than as lists ofEelco Dolstra1-11/+16
values. This improves sharing and gives another speed up. Evaluation of the NixOS system attribute is now almost 7 times faster than the old evaluator.
2010-04-14 * Fix builtins.Eelco Dolstra1-15/+11
2010-04-14 * After parsing, compute level/displacement pairs for each variableEelco Dolstra1-0/+4
use site, allowing environments to be stores as vectors of values rather than maps. This should speed up evaluation and reduce the number of allocations.
2010-04-13 * Use a symbol table to represent identifiers and attribute namesEelco Dolstra1-13/+14
efficiently. The symbol table ensures that there is only one copy of each symbol, thus allowing symbols to be compared efficiently using a pointer equality test.
2010-04-12 * Finished the ATerm-less parser.Eelco Dolstra1-2/+2
2010-04-12 * Don't use ATerms for the abstract syntax trees anymore. NotEelco Dolstra1-20/+18
finished yet.
2010-04-07 * expr-to-xml -> value-to-xml.Eelco Dolstra1-1/+1
2010-04-07 * Implemented the primops necessary for generating the NixOS manual.Eelco Dolstra1-30/+34
2010-04-01 * Make `derivation' lazy again for performance. It also turns outEelco Dolstra1-28/+8
that there are some places in Nixpkgs (php_configurable / composableDerivation, it seems) that call `derivation' with incorrect arguments (namely, the `name' attribute missing) but get away with it because of laziness.
2010-03-31 * Fixed the trace primop and path comparison.Eelco Dolstra1-41/+8
* Removed exprToString and stringToExpr because there is no ATerm representation to work on anymore (and exposing the internals of the evaluator like this is not a good idea anyway).
2010-03-31 * Handle string contexts. `nix-instantiate' can now correctly computeEelco Dolstra1-2/+2
the `firefoxWrapper' attribute in Nixpkgs, and it's about 3 times faster than the trunk :-)
2010-03-31 * Implemented derivations.Eelco Dolstra1-85/+65
2010-03-30 * More primops.Eelco Dolstra1-86/+98
2010-03-30 * More operators / primops.Eelco Dolstra1-27/+28
2010-03-30 * More primops.Eelco Dolstra1-51/+53
2010-03-30 * More primops.Eelco Dolstra1-86/+23
2010-03-30 * Implemented `map'.Eelco Dolstra1-7/+15
2010-03-30 * Make `import' work.Eelco Dolstra1-14/+9
2010-03-29 * Started integrating the new evaluator.Eelco Dolstra1-16/+42
2010-03-25 * Simplify @-patterns: only `{attrs}@name' or `name@{attrs}' are nowEelco Dolstra1-6/+1
allowed. So `name1@name2', `{attrs1}@{attrs2}' and so on are now no longer legal. This is no big loss because they were not useful anyway. This also changes the output of builtins.toXML for @-patterns slightly.
2009-10-22 * builtins.trace: in the common case that the value is a string, thenEelco Dolstra1-1/+6
show the string, not the ATerm, so we get `trace: bla' instead of `trace: Str("bla",[])'.
2009-10-21 * Added a primop unsafeDiscardOutputDependency needed by Disnix toEelco Dolstra1-3/+34
pass derivation paths to a builder without actually building them.
2009-09-23 * tryEval shouldn't catch all exceptions of type Error, since not allEelco Dolstra1-2/+2
of them leave the evaluator in a continuable state. Also, it should be less chatty.
2009-09-15 * Two primops: builtins.intersectAttrs and builtins.functionArgs.Eelco Dolstra1-0/+66
intersectAttrs returns the (right-biased) intersection between two attribute sets, e.g. every attribute from the second set that also exists in the first. functionArgs returns the set of attributes expected by a function. The main goal of these is to allow the elimination of most of all-packages.nix. Most package instantiations in all-packages.nix have this form: foo = import ./foo.nix { inherit a b c; }; With intersectAttrs and functionArgs, this can be written as: foo = callPackage (import ./foo.nix) { }; where callPackage = f: args: f ((builtins.intersectAttrs (builtins.functionArgs f) pkgs) // args); I.e., foo.nix is called with all attributes from "pkgs" that it actually needs (e.g., pkgs.a, pkgs.b and pkgs.c). (callPackage can do any other generic package-level stuff we might want, such as applying makeOverridable.) Of course, the automatically supplied arguments can be overriden if needed, e.g. foo = callPackage (import ./foo.nix) { c = c_version_2; }; but for the vast majority of packages, this won't be needed. The advantages are to reduce the amount of typing needed to add a dependency (from three sites to two), and to reduce the number of trivial commits to all-packages.nix. For the former, there have been two previous attempts: - Use "args: with args;" in the package's function definition. This however obscures the actual expected arguments of a function, which is very bad. - Use "{ arg1, arg2, ... }:" in the package's function definition (i.e. use the ellipis "..." to allow arbitrary additional arguments), and then call the function with all of "pkgs" as an argument. But this inhibits error detection if you call it with an misspelled (or obsolete) argument.
2009-08-25 Adding tryEval builtin. It allows to catch presence of errors in an expression.Michael Raskin1-0/+18
2009-06-30 * Don't show trace information by default (`--show-trace' to enable).Eelco Dolstra1-1/+1
NixOS evaluation errors in particular look intimidating and generally aren't very useful. Ideally the builtins.throw messages should be self-contained.
2009-03-18 * Unify exportReferencesGraph and exportBuildReferencesGraph, and makeEelco Dolstra1-12/+18
sure that it works as expected when you pass it a derivation. That is, we have to make sure that all build-time dependencies are built, and that they are all in the input closure (otherwise remote builds might fail, for example). This is ensured at instantiation time by adding all derivations and their sources to inputDrvs and inputSrcs.
2009-02-05 added primop functions __isBool, __isString, __isIntMarc Weber1-0/+25
2009-01-27 Add the "addErrorContext" builtin to add more information in the stack trace.Nicolas Pierron1-0/+14
2008-12-04 (no commit message)Eelco Dolstra1-3/+4
2008-12-04 * Dirty hack to make nix-push work properly on derivations: theEelco Dolstra1-8/+23
derivation should be a source rather than a derivation dependency of the call to the NAR derivation. Otherwise the derivation (and all its dependencies) will be built as a side-effect, which may not even succeed.
2008-12-03 * Pass HashType values instead of strings.Eelco Dolstra1-3/+3
2008-12-03 * Made addToStore() a lot more efficient: it no longer reads the pathEelco Dolstra1-3/+1
being copied 3 times in the worst case. It doesn't run in constant space, but it didn't do that anyway.
2008-12-03 * Unify the treatment of sources copied to the store, and recursiveEelco Dolstra1-22/+26
SHA-256 outputs of fixed-output derivations. I.e. they now produce the same store path: $ nix-store --add x /nix/store/j2fq9qxvvxgqymvpszhs773ncci45xsj-x $ nix-store --add-fixed --recursive sha256 x /nix/store/j2fq9qxvvxgqymvpszhs773ncci45xsj-x the latter being the same as the path that a derivation derivation { name = "x"; outputHashAlgo = "sha256"; outputHashMode = "recursive"; outputHash = "..."; ... }; produces. This does change the output path for such fixed-output derivations. Fortunately they are quite rare. The most common use is fetchsvn calls with SHA-256 hashes. (There are a handful of those is Nixpkgs, mostly unstable development packages.) * Documented the computation of store paths (in store-api.cc).
2008-11-19 * Primop builtins.storePath for declaring a store path as aEelco Dolstra1-0/+22
dependency. `storePath /nix/store/bla' gives exactly the same result as `toPath /nix/store/bla', except that the former includes /nix/store/bla in the dependency context of the string. Useful in some generated Nix expressions like nix-push, which now finally does the right thing wrt distributed builds. (Previously the path to be packed wasn't an explicit dependency, so it wouldn't be copied to the remote machine.)
2008-08-14 * Refactoring: combine functions that take an attribute set andEelco Dolstra1-5/+3
functions that take a single argument (plain lambdas) into one AST node (Function) that contains a Pattern node describing the arguments. Current patterns are single lazy arguments (VarPat) and matching against an attribute set (AttrsPat). This refactoring allows other kinds of patterns to be added easily, such as Haskell-style @-patterns, or list pattern matching.
2008-07-11 * Generalised the dependencyClosure primop to builtins.genericClosure,Eelco Dolstra1-137/+55
which is hopefully more useful. * New primops: length, mul, div.
2008-07-01 * Export the nix-env derivation name parsing and version comparisonEelco Dolstra1-14/+49
logic through the `parseDrvName' and `compareVersions' primops. This will allow expressions to easily check whether some dependency is a specific needed version or falls in some version range. See tests/lang/eval-okay-versions.nix for examples.
2008-01-20 Probably fixed __exprToStringMichael Raskin1-1/+4
2008-01-15 Fixed exportBuildReferenceGraphMichael Raskin1-0/+18
2008-01-04 * New primop `unsafeDiscardStringContext' to get rid of stringEelco Dolstra1-0/+10
contexts. Needed to prevent unnecessary dependencies when building the NixOS manual.
2007-12-31 * More release notes.Eelco Dolstra1-2/+2
2007-11-21 * New primop `readFile' to get the contents of a file as a string.Eelco Dolstra1-0/+12
2007-10-31 * Documented multi-user Nix.Eelco Dolstra1-0/+3
2007-10-26 * "trace" primop: write the trace to standard error.Eelco Dolstra1-6/+7
2007-10-09 * listToAttrs: the list now should consist of {name, value} attributeEelco Dolstra1-28/+29
sets instead of {attr, value}. "name" is better than "attr" because the *combination* of the two forms the attribute.
2007-09-18 * Pass various options to the worker so that flags like -K or -j workEelco Dolstra1-2/+1
in multi-user Nix (NIX-72). * Client/worker: exchange a protocol version number for future compatibility.
2007-08-18 primop functions listToAttrs (+test), __isAttrs, __trace addedMarc Weber1-0/+53
new configuration style proposal in lib/default-unstable.nix
2007-05-16 * New builtin function "isFunction". You're not supposed to use itEelco Dolstra1-0/+13
;-) * Channels: fix channels that are plain lists of derivations (like strategoxt-unstable) instead of functions (like nixpkgs-unstable). This fixes the error message "error: the left-hand side of the function call is neither a function nor a primop (built-in operation) but a list".
2007-04-16 * New primop "throw <string>" to throw an error. This is like abort,Eelco Dolstra1-0/+9
only thrown errors are caught by the top-level derivation evaluation in nix-env -qa / -i.