about summary refs log tree commit diff
path: root/src/libexpr
AgeCommit message (Collapse)AuthorFilesLines
2014-02-26 Warn about missing -I pathsEelco Dolstra3-5/+6
Fixes #121. Note that we don't warn about missing $NIX_PATH entries because it's intended that some may be missing (cf. the default $NIX_PATH on NixOS, which includes paths like /etc/nixos/nixpkgs for backward compatibility).
2014-02-18 lexer-tab.o and parser-tab.o require each other's headersShea Levy1-0/+4
2014-02-01 More "make dist" fixesEelco Dolstra1-0/+2
2014-02-01 Fix "make dist"Eelco Dolstra1-2/+4
2014-02-01 Remove AutomakefilesEelco Dolstra1-40/+0
2014-02-01 Update Makefile variable namesEelco Dolstra1-1/+1
2014-01-30 Rename Makefile -> local.mkEelco Dolstra1-0/+0
2014-01-21 Fix some clang warningsEelco Dolstra4-12/+11
2014-01-21 Fix building against Bison 3.0.2Eelco Dolstra1-1/+1
2014-01-21 Merge branch 'master' into makeEelco Dolstra6-66/+231
Conflicts: src/libexpr/eval.cc
2014-01-14 Bare dynamic attrs: Match interpolation semanticsShea Levy1-1/+1
Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-14 Allow "bare" dynamic attrsShea Levy2-0/+3
Now, in addition to a."${b}".c, you can write a.${b}.c (applicable wherever dynamic attributes are valid). Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-09 Update MakefilesEelco Dolstra1-4/+1
2013-12-31 Don't use any syntactic sugar for dynamic attrsShea Levy4-128/+68
This doesn't change any functionality but moves some behavior out of the parser and into the evaluator in order to simplify the code. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-31 Fold dynamic binds handling into addAttrShea Levy1-55/+35
Since addAttr has to iterate through the AttrPath we pass it, it makes more sense to just iterate through the AttrNames in addAttr instead. As an added bonus, this allows attrsets where two dynamic attribute paths have the same static leading part (see added test case for an example that failed previously). Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-31 Dynamic attrsShea Levy4-23/+238
This adds new syntax for attribute names: * attrs."${name}" => getAttr name attrs * attrs ? "${name}" => isAttrs attrs && hasAttr attrs name * attrs."${name}" or def => if attrs ? "${name}" then attrs."${name}" else def * { "${name}" = value; } => listToAttrs [{ inherit name value; }] Of course, it's a bit more complicated than that. The attribute chains can be arbitrarily long and contain combinations of static and dynamic parts (e.g. attrs."${foo}".bar."${baz}" or qux), which is relatively straightforward for the getAttrs/hasAttrs cases but is more complex for the listToAttrs case due to rules about duplicate attribute definitions. For attribute sets with dynamic attribute names, duplicate static attributes are detected at parse time while duplicate dynamic attributes are detected when the attribute set is forced. So, for example, { a = null; a.b = null; "${"c"}" = true; } will be a parse-time error, while { a = {}; "${"a"}".b = null; c = true; } will be an eval-time error (technically that case could theoretically be detected at parse time, but the general case would require full evaluation). Moreover, duplicate dynamic attributes are not allowed even in cases where they would be with static attributes ({ a.b.d = true; a.b.c = false; } is legal, but { a."${"b"}".d = true; a."${"b"}".c = false; } is not). This restriction might be relaxed in the future in cases where the static variant would not be an error, but it is not obvious that that is desirable. Finally, recursive attribute sets with dynamic attributes have the static attributes in scope but not the dynamic ones. So rec { a = true; "${"b"}" = a; } is equivalent to { a = true; b = true; } but rec { "${"a"}" = true; b = a; } would be an error or use a from the surrounding scope if it exists. Note that the getAttr, getAttr or default, and hasAttr are all implemented purely in the parser as syntactic sugar, while attribute sets with dynamic attribute names required changes to the AST to be implemented cleanly. This is an alternative solution to and closes #167 Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-31 Add the ExprBuiltin Expr type to the ASTShea Levy4-9/+36
Certain desugaring schemes may require the parser to use some builtin function to do some of the work (e.g. currently `throw` is used to lazily cause an error if a `<>`-style path is not in the search path) Unfortunately, these names are not reserved keywords, so an expression that uses such a syntactic sugar will not see the expected behavior (see tests/lang/eval-okay-redefine-builtin.nix for an example). This adds the ExprBuiltin AST type, which when evaluated uses the value from the rootmost variable scope (which of course is initialized internally and can't shadow any of the builtins). Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-10 Bump language version for new storePath featureShea Levy1-1/+1
This will allow e.g. channel expressions to use builtins.storePath IFF it is safe to do so without knowing if the path is valid yet. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-10 builtins.storePath: Try to substitute the path if it is not yet validShea Levy1-2/+2
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-11-25 Rename Makefile.new -> MakefileEelco Dolstra1-0/+0
2013-11-23 Use libnix as a prefix for all Nix librariesEelco Dolstra1-0/+2
In particular "libutil" was always a problem because it collides with Glibc's libutil. Even if we install into $(libdir)/nix, the linker sometimes got confused (e.g. if a program links against libstore but not libutil, then ld would report undefined symbols in libstore because it was looking at Glibc's libutil).
2013-11-23 Drop the dependency on libgc in libmainEelco Dolstra2-0/+22
Instead, libexpr now depends on libgc. This means commands like nix-store that don't do any evaluation no longer require libgc.
2013-11-23 Initialise Boehm GC only onceEelco Dolstra1-2/+2
2013-11-23 Allow (dynamic) libraries to depend on other librariesEelco Dolstra1-0/+2
2013-11-23 Implement basic ‘make install’Eelco Dolstra1-0/+1
2013-11-22 Rename $(here) to $(d) for brevity, and remove trailing slashEelco Dolstra1-5/+5
2013-11-22 Generate the parser and the lexerEelco Dolstra1-1/+5
2013-11-22 New non-recursive, plain Make-based build systemEelco Dolstra1-0/+10
2013-11-19 Check meta values and warn about bad onesEelco Dolstra2-2/+22
2013-11-19 Generalise meta attributesEelco Dolstra2-87/+118
2013-11-19 Shorter error messageEelco Dolstra1-2/+1
2013-11-19 Refactor JSON outputEelco Dolstra2-13/+56
2013-11-19 Add a toJSON primopEelco Dolstra6-24/+150
2013-11-18 Add a primop unsafeGetAttrPos to return the position of an attributeEelco Dolstra4-6/+37
2013-11-18 Add a symbol __curPos that expands to the current source locationEelco Dolstra5-2/+37
I.e. an attribute set { file = <string>; line = <int>; column = <int>; }.
2013-11-18 Support quoted attribute names in -AEelco Dolstra1-10/+34
This is requires if you have attribute names with dots in them. So you can now say: $ nix-instantiate '<nixos>' -A 'config.systemd.units."postgresql.service".text' --eval-only Fixes #151.
2013-11-12 Make function calls show up in stack traces againEelco Dolstra1-20/+28
Note that adding --show-trace prevents functions calls from being tail-recursive, so an expression that evaluates without --show-trace may fail with a stack overflow if --show-trace is given.
2013-11-12 Make function calls tail-recursiveEelco Dolstra4-40/+65
2013-11-12 Make ifs and asserts tail-recursiveEelco Dolstra2-4/+11
The local Value object prevented g++ from making a tail call. Not clear why. In any case, not using a temporary makes g++ do the tail call.
2013-11-12 Get rid of an intermediary on the stackEelco Dolstra2-13/+17
2013-10-28 Fix building without a garbage collectorEelco Dolstra1-5/+5
http://hydra.nixos.org/build/6695350
2013-10-28 Fix a segfault in genericClosureEelco Dolstra1-16/+25
It kept temporary data in STL containers that were not scanned by Boehm GC, so Nix programs using genericClosure could randomly crash if the garbage collector kicked in at a bad time. Also make it a bit more efficient by copying points to values rather than values.
2013-10-28 Slightly optimize listToAttrsEelco Dolstra3-9/+10
2013-10-24 Rename "attribute sets" to "sets"Eelco Dolstra8-54/+47
We don't have any other kind of sets so calling them attribute sets is unnecessarily verbose.
2013-10-24 Remove unnecessary call to forceStringNoCtxEelco Dolstra1-1/+1
2013-10-24 Add a typeOf primopEelco Dolstra1-3/+28
We already have some primops for determining the type of a value, such as isString, but they're incomplete: for instance, there is no isPath. Rather than adding more isBla functions, the generic typeOf function returns a string representing the type of the argument (e.g. "int").
2013-10-24 Don't require NIX_SHOW_STATS for NIX_COUNT_CALLSEelco Dolstra1-0/+1
2013-10-23 Memoize evalFile() lookups under both the original and resolved nameEelco Dolstra1-4/+9
Previously we only used the resolved name, causing repeated resolution (e.g. /dir to /dir/default.nix).
2013-10-17 Fold two stack trace messages in derivationsEelco Dolstra1-4/+2
Combined with the previous changes, stack traces involving derivations are now much less verbose, since something like while evaluating the builtin function `getAttr': while evaluating the builtin function `derivationStrict': while instantiating the derivation named `gtk+-2.24.20' at `/home/eelco/Dev/nixpkgs/pkgs/development/libraries/gtk+/2.x.nix:11:3': while evaluating the derivation attribute `propagatedNativeBuildInputs' at `/home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/default.nix:78:17': while evaluating the attribute `outPath' at `/nix/store/212ngf4ph63mp6p1np2bapkfikpakfv7-nix-1.6/share/nix/corepkgs/derivation.nix:18:9': ... now reads while evaluating the attribute `propagatedNativeBuildInputs' of the derivation `gtk+-2.24.20' at `/home/eelco/Dev/nixpkgs/pkgs/development/libraries/gtk+/2.x.nix:11:3': ...
2013-10-17 Don't show <nix/derivation.nix> in stack tracesEelco Dolstra3-2/+5
Messages like while evaluating the attribute `outPath' at `/nix/store/212ngf4ph63mp6p1np2bapkfikpakfv7-nix-1.6/share/nix/corepkgs/derivation.nix:18:9': are redundant, because Nix already shows that it's evaluating a derivation: while instantiating the derivation named `firefox-24.0' at `/home/eelco/Dev/nixpkgs/pkgs/applications/networking/browsers/firefox/default.nix:131:5': while evaluating the derivation attribute `nativeBuildInputs' at `/home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/default.nix:76:17':