about summary refs log tree commit diff
path: root/src/libexpr/nixexpr.cc
AgeCommit message (Collapse)AuthorFilesLines
2009-05-15 * Some syntactic sugar for attribute sets: allow {x.y.z = ...;} as aEelco Dolstra1-1/+1
shorthand for {x = {y = {z = ...;};};}. This is especially useful for NixOS configuration files, e.g. { services = { sshd = { enable = true; port = 2022; }; }; } can now be written as { services.sshd.enable = true; services.sshd.port = 2022; } However, it is currently not permitted to write { services.sshd = {enable = true;}; services.sshd.port = 2022; } as this is considered a duplicate definition of `services.sshd'.
2008-08-14 * Added an experimental feature suggested by Andres: ellipses ("...")Eelco Dolstra1-2/+3
in attribute set pattern matches. This allows defining a function that takes *at least* the listed attributes, while ignoring additional attributes. For instance, {stdenv, fetchurl, fuse, ...}: stdenv.mkDerivation { ... }; defines a function that requires an attribute set that contains the specified attributes but ignores others. The main advantage is that we can then write in all-packages.nix aefs = import ../bla/aefs pkgs; instead of aefs = import ../bla/aefs { inherit stdenv fetchurl fuse; }; This saves a lot of typing (not to mention not having to update all-packages.nix with purely mechanical changes). It saves as much typing as the "args: with args;" style, but has the advantage that the function arguments are properly declared (not implicit in what the body of the "with" uses).
2008-08-14 * @-patterns as in Haskell. For instance, in a function definitionEelco Dolstra1-1/+6
f = args @ {x, y, z}: ...; `args' refers to the argument as a whole, which is further pattern-matched against the attribute set pattern {x, y, z}.
2008-08-14 * Refactoring: combine functions that take an attribute set andEelco Dolstra1-37/+30
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-08-11 * Removed the "valid values" feature. Nobody uses it anyway.Eelco Dolstra1-7/+6
2008-05-21 * GCC 4.3.0 (Fedora 9) compatibility fixes. Reported by Gour andEelco Dolstra1-0/+2
Armijn Hemel.
2008-02-21 * checkVarDefs: don't check in closed terms, which don't haveEelco Dolstra1-1/+5
undefined variables by definition. This matters for the implementation of "with", which does a call to checkVarDefs to see if the body of the with has no undefined variables. (It can't be checked at parse time because you don't know which variables are in the "with" attribute set.) If we check closed terms, then we check not just the with body but also the substituted terms, which are typically very large. This is the cause of the poor nix-env performance on Nixpkgs lately. It didn't happen earlier because "with" wasn't used very often in the past. This fix improves nix-env performance roughly 60x on current Nixpkgs. nix-env -qa is down from 29.3s to 0.5s on my laptop, and nix-env -qa --out-path is down from 229s to 3.39s. Not bad for a 1-line fix :-)
2007-02-02 * nix-env now maintains meta info (from the `meta' derivationEelco Dolstra1-1/+1
attribute) about installed packages in user environments. Thus, an operation like `nix-env -q --description' shows useful information not only on available packages but also on installed packages. * nix-env now passes the entire manifest as an argument to the Nix expression of the user environment builder (not just a list of paths), so that in particular the user environment builder has access to the meta attributes. * New operation `--set-flag' in nix-env to change meta info of installed packages. This will be useful to pass per-package policies to the user environment builder (e.g., how to resolve collision or whether to disable a package (NIX-80)) or upgrade policies in nix-env (e.g., that a package should be "masked", that is, left untouched by upgrade actions). Example: $ nix-env --set-flag enabled false ghc-6.4
2007-01-13 * Canonicalise ASTs in `nix-instantiate --eval': remove positionEelco Dolstra1-0/+39
info, sort attribute sets.
2006-10-23 * Some better error messages.Eelco Dolstra1-2/+2
2006-10-16 * Big cleanup of the semantics of paths, strings, contexts, stringEelco Dolstra1-7/+30
concatenation and string coercion. This was a big mess (see e.g. NIX-67). Contexts are now folded into strings, so that they don't cause evaluation errors when they're not expected. The semantics of paths has been clarified (see nixexpr-ast.def). toString() and coerceToString() have been merged. Semantic change: paths are now copied to the store when they're in a concatenation (and in most other situations - that's the formalisation of the meaning of a path). So "foo " + ./bla evaluates to "foo /nix/store/hash...-bla", not "foo /path/to/current-dir/bla". This prevents accidental impurities, and is more consistent with the treatment of derivation outputs, e.g., `"foo " + bla' where `bla' is a derivation. (Here `bla' would be replaced by the output path of `bla'.)
2006-10-11 * Removed URIs from the evaluator (NIX-66). They are now just anotherEelco Dolstra1-2/+0
kind of notation for strings.
2006-10-03 * toFile: added an additional argument to specify the store pathEelco Dolstra1-0/+2
suffix, e.g., `builtins.toFile "builder.sh" "..."'. * toFile: handle references to other files correctly.
2006-09-05 * Sone missing #includes.Eelco Dolstra1-0/+1
2006-09-04 * Use a proper namespace.Eelco Dolstra1-1/+7
* Optimise header file usage a bit. * Compile the parser as C++.
2006-08-04 * Fix a few warnings.Eelco Dolstra1-2/+2
2006-07-28 * `nix-instantiate --print-args': print out the valid values forEelco Dolstra1-0/+24
functions arguments that have a domain.
2006-07-24 * New language feature: domain checks, which check whether a functionEelco Dolstra1-4/+5
argument has a valid value, i.e., is in a certain domain. E.g., { foo : [true false] , bar : ["a" "b" "c"] }: ... This previously could be done using assertions, but domain checks will allow the buildfarm to automatically extract the configuration space from functions.
2006-07-24 * Refactoring to support domain checks.Eelco Dolstra1-9/+6
2006-07-19 * Better error messages (especially wrt types).Eelco Dolstra1-3/+24
2006-07-11 * Doh! Of couse we cannot memoize across scopes.Eelco Dolstra1-4/+8
2006-05-04 * Use the new ATermMap.Eelco Dolstra1-124/+6
2006-05-02 * Use a linked list of substitutions. This reduces the amount ofEelco Dolstra1-14/+20
copying.
2006-05-02 * Removed a bunch of ATreverses.Eelco Dolstra1-1/+1
2006-05-02 * Memory reduction: replaced expensive calls to ATmakeApplList byEelco Dolstra1-11/+16
ATmakeApplArray, and got rid of ATreverse in substitute().
2006-05-02 * Some preliminaries towards NIX-45.Eelco Dolstra1-6/+11
2006-03-10 * In theory, this should reduce the number of ATermMapEelco Dolstra1-2/+3
re-allocations.
2005-11-04 * Memoise checkVarDefs since internally produced terms (i.e., not theEelco Dolstra1-9/+24
result of parsing) can have very heavy sharing, causing exponential complexity if we naively recurse into them. ATerms are graphs, not trees!
2005-07-19 * Prevent repeated wrapping of closed termsEelco Dolstra1-1/+6
(closed(closed(closed(...)))) since this reduces performance by producing bigger terms and killing caching (which incidentally also prevents useful infinite recursion detection).
2005-05-08 * ATermMap needs an assignment operator, otherwise we are screwed.Eelco Dolstra1-6/+31
2005-01-19 * Renamed `normalise.cc' -> `build.cc', `storeexprs.cc' ->Eelco Dolstra1-1/+1
`derivations.cc', etc. * Store the SHA-256 content hash of store paths in the database after they have been built/added. This is so that we can check whether the store has been messed with (a la `rpm --verify'). * When registering path validity, verify that the closure property holds.
2004-11-03 * string2ATerm -> overloaded toATerm.Eelco Dolstra1-3/+3
2004-10-29 * Drop ATmake / ATMatcher also in handling store expressions.Eelco Dolstra1-2/+2
2004-10-26 * Don't use ATmake / ATmatch anymore, nor the ATMatcher class.Eelco Dolstra1-86/+51
Instead we generate data bindings (build and match functions) for the constructors specified in `constructors.def'. In particular this removes the conversions between AFuns and strings, and Nix expression evaluation now seems 3 to 4 times faster.
2004-10-26 * String/path concatenation operator (`+').Eelco Dolstra1-0/+12
2004-10-25 * New language feature: with expressions.Eelco Dolstra1-1/+8
The expression `with E1; E2' evaluates to E2 with all bindings in the attribute set E1 substituted. E.g., with {x = 123;}; x evaluates to 123. That is, the attribute set E1 is in scope in E2. This is particularly useful when importing files containing lots definitions. E.g., instead of let { inherit (import ./foo.nix) a b c d e f; body = ... a ... f ...; } we can now say with import ./foo.nix; ... a ... f ... I.e., we don't have to say what variables should be brought into scope.
2004-04-05 * When something goes wrong in the evaluation of a Nix expression,Eelco Dolstra1-16/+58
print a nice backtrace of the stack, rather than vomiting a gigantic (and useless) aterm on the screen. Example: error: while evaluating file `.../pkgs/system/test.nix': while evaluating attribute `subversion' at `.../pkgs/system/all-packages-generic.nix', line 533: while evaluating function at `.../pkgs/applications/version-management/subversion/default.nix', line 1: assertion failed at `.../pkgs/applications/version-management/subversion/default.nix', line 13 Since the Nix expression language is lazy, the trace may be misleading. The purpose is to provide a hint as to the location of the problem.
2004-03-30 * The recent change in nixpkgs of calling `stdenv.mkDerivation'Eelco Dolstra1-2/+6
instead of `derivation' triggered a huge slowdown in the Nix expression evaluator. Total execution time of `nix-env -qa' went up by a factor of 60 or so. This scalability problem was caused by expressions such as (x: y: ... x ...) a b where `a' is a large term (say, the one in `all-packages-generic.nix'). Then the first beta-reduction would produce (y: ... a ...) b by substituting `a' for `x'. The second beta-reduction would then substitute `b' for `y' into the body `... a ...', which is a large term due to `a', and thus causes a large traversal to be performed by substitute() in the second reduction. This is however entirely redundant, since `a' cannot contain free variables (since we never substitute below a weak head normal form). The solution is to wrap substituted terms into a `Closed' constructor, i.e., subst(subs, Var(x)) = Closed(e) iff subs[x] = e have substitution not descent into closed terms, subst(subs, Closed(x)) = Closed(x) and otherwise ignore them for evaluation, eval(Closed(x)) = eval(x). * Fix a typo that caused incorrect substitutions to be performed in simple lambdas, e.g., `(x: x: x) a' would reduce to `(x: a)'.
2004-03-28 * Added plain lambdas, e.g., `let { id = x: x; const = x: y: x; }'.Eelco Dolstra1-3/+16
`bla:' is now no longer parsed as a URL. * Re-enabled support for the `args' attribute in derivations to specify command line arguments to the builder, e.g., ... builder = /usr/bin/python; args = ["-c" ./builder.py]; ...
2004-02-16 * Inherited attributes in recursive attribute sets are in scope of theEelco Dolstra1-4/+11
non-inherited attributes.
2004-02-04 * Use a map to lookup primops.Eelco Dolstra1-2/+21
* Various performance improvements in the evaluator. * Do not link against unused (and missing!) libraries (-lsglr, etc.).
2004-02-03 * Verify that all variables in a Nix expression are defined.Eelco Dolstra1-12/+63
2004-02-02 * Added syntactic sugar to the construction of attribute sets toEelco Dolstra1-4/+6
`inherit' variables from the surrounding lexical scope. E.g., {stdenv, libfoo}: derivation { builder = ./bla; inherit stdenv libfoo; xyzzy = 1; } is equivalent to {stdenv, libfoo}: derivation { builder = ./bla; stdenv = stdenv; libfoo = libfoo; xyzzy = 1; } Note that for mutually recursive attribute set definitions (`rec {...}'), this also works, that is, `rec {inherit x;}' is equivalent to `let {fresh = x; body = rec {x = fresh;};}', *not* `rec {x = x}'.
2004-01-21 * Fixed a subtle uninitialised variable bug in ATermMaps copied fromEelco Dolstra1-1/+3
ATermMaps. Found thanks to Valgrind!
2004-01-15 * Catch SIGINT to terminate cleanly when the user tries to interruptEelco Dolstra1-0/+4
Nix. This is to prevent Berkeley DB from becoming wedged. Unfortunately it is not possible to throw C++ exceptions from a signal handler. In fact, you can't do much of anything except change variables of type `volatile sig_atomic_t'. So we set an interrupt flag in the signal handler and check it at various strategic locations in the code (by calling checkInterrupt()). Since this is unlikely to cover all cases (e.g., (semi-)infinite loops), sometimes SIGTERM may now be required to kill Nix.
2003-11-19 * Refactoring: put the Nix expression evaluator in its own library soEelco Dolstra1-0/+215
that it can be used by multiple programs.