about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
AgeCommit message (Collapse)AuthorFilesLines
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.
2007-01-29 * computeStorePathForText: take the references into account whenEelco Dolstra1-1/+1
computing the store path (NIX-77). This is an important security property in multi-user Nix stores. Note that this changes the store paths of derivations (since the derivation aterms are added using addTextToStore), but not most outputs (unless they use builtins.toFile).
2007-01-29 * Don't capitalise the primop functions.Eelco Dolstra1-76/+81
2007-01-29 * Organise primops.cc a bit better.Eelco Dolstra1-321/+376
2007-01-29 New primitives:Eelco Dolstra1-1/+43
* `sub' to subtract two numbers. * `stringLength' to get the length of a string. * `substring' to get a substring of a string. These should be enough to allow most string operations to be expressed.
2007-01-29 * filterSource: pass strings to the predicate function instead ofEelco Dolstra1-1/+1
paths. Paths can have unexpected semantics.
2007-01-15 * builtins.filterSource: pass the type of the file ("regular",Eelco Dolstra1-1/+18
"directory", "symlink") as the second argument to the filter predicate.
2007-01-13 * Cleanup.Eelco Dolstra1-5/+5
2006-12-13 * Remove debug message.Eelco Dolstra1-1/+0
2006-12-12 * New primop builtins.filterSource, which can be used to filter filesEelco Dolstra1-0/+38
from a source directory. All files for which a predicate function returns true are copied to the store. Typical example is to leave out the .svn directory: stdenv.mkDerivation { ... src = builtins.filterSource (path: baseNameOf (toString path) != ".svn") ./source-dir; # as opposed to # src = ./source-dir; } This is important because the .svn directory influences the hash in a rather unpredictable and variable way.
2006-12-12 * New built-in function `builtins.attrNames' that returns theEelco Dolstra1-0/+21
names of the attributes in an attribute set.
2006-12-01 * Replace read-only calls to addTextToStore.Eelco Dolstra1-1/+3
2006-11-30 * Put building in the store API.Eelco Dolstra1-2/+1
2006-11-30 * Refactoring. There is now an abstract interface class StoreAPIEelco Dolstra1-3/+3
containing functions that operate on the Nix store. One implementation is LocalStore, which operates on the Nix store directly. The next step, to enable secure multi-user Nix, is to create a different implementation RemoteStore that talks to a privileged daemon process that uses LocalStore to perform the actual operations.
2006-11-03 * Fix importing of derivation outputs.Eelco Dolstra1-2/+9
2006-10-23 * Some better error messages.Eelco Dolstra1-3/+10
2006-10-19 * Better message.Eelco Dolstra1-1/+1
2006-10-19 * toFile: maintain the references.Eelco Dolstra1-10/+4
2006-10-17 * baseNameOf: paths don't have to be absolute.Eelco Dolstra1-1/+1
2006-10-17 * toPath: should be the identity on paths.Eelco Dolstra1-3/+1
2006-10-17 * dirOf: return a path if the argument is a path.Eelco Dolstra1-2/+6