about summary refs log tree commit diff
path: root/src/libexpr/eval.hh
AgeCommit message (Collapse)AuthorFilesLines
2016-11-26 Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra1-1/+1
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25 Get rid of unicode quotes (#1140)Guillaume Maudoux1-1/+1
2016-08-30 Fix GC buildEelco Dolstra1-4/+0
2016-08-29 forceBool(): Show position infoEelco Dolstra1-1/+1
2016-08-29 Add builtin function "partition"Eelco Dolstra1-1/+2
The implementation of "partition" in Nixpkgs is O(n^2) (because of the use of ++), and for some reason was causing stack overflows in multi-threaded evaluation (not sure why). This reduces "nix-env -qa --drv-path" runtime by 0.197s and memory usage by 298 MiB (in non-Boehm mode).
2016-08-23 nix build: Use Nix search pathEelco Dolstra1-2/+4
That is, unless --file is specified, the Nix search path is synthesized into an attribute set. Thus you can say $ nix build nixpkgs.hello assuming $NIX_PATH contains an entry of the form "nixpkgs=...". This is more verbose than $ nix build hello but is less ambiguous.
2016-04-14 Make the search path lazier with non-fatal errorsEelco Dolstra1-2/+8
Thus, -I / $NIX_PATH entries are now downloaded only when they are needed for evaluation. An error to download an entry is a non-fatal warning (just like non-existant paths). This does change the semantics of builtins.nixPath, which now returns the original, rather than resulting path. E.g., before we had [ { path = "/nix/store/hgm3yxf1lrrwa3z14zpqaj5p9vs0qklk-nixexprs.tar.xz"; prefix = "nixpkgs"; } ... ] but now [ { path = "https://nixos.org/channels/nixos-16.03/nixexprs.tar.xz"; prefix = "nixpkgs"; } ... ] Fixes #792.
2016-04-14 Make primop registration pluggableEelco Dolstra1-2/+2
This way we don't have to put all primops in one giant file.
2016-02-12 Merge pull request #762 from ctheune/ctheune-floatsEelco Dolstra1-0/+1
Implement floats
2016-02-04 StoreAPI -> StoreEelco Dolstra1-3/+3
Calling a class an API is a bit redundant...
2016-02-04 Eliminate the "store" global variableEelco Dolstra1-4/+6
Also, move a few free-standing functions into StoreAPI and Derivation. Also, introduce a non-nullable smart pointer, ref<T>, which is just a wrapper around std::shared_ptr ensuring that the pointer is never null. (For reference-counted values, this is better than passing a "T&", because the latter doesn't maintain the refcount. Usually, the caller will have a shared_ptr keeping the value alive, but that's not always the case, e.g., when passing a reference to a std::thread via std::bind.)
2016-01-05 Use __toString when coercing sets to strings.Shea Levy1-1/+1
For example, "${{ foo = "bar"; __toString = x: x.foo; }}" evaluates to "bar". With this, we can delay calling functions like mkDerivation, buildPythonPackage, etc. until we actually need a derivation, enabling overrides and other modifications to happen by simple attribute set update.
2016-01-05 First hit at providing support for floats in the language.Christian Theune1-0/+1
2015-10-08 forceFunction: allow functors as wellMathnerd3141-0/+2
2015-07-31 Output line number on infinite recursionIwan Aucamp1-1/+1
2015-07-23 CleanupEelco Dolstra1-13/+13
2015-07-23 Optimize empty setsEelco Dolstra1-1/+3
This reduces the number of Bindings allocations by about 10%.
2015-07-14 Move attribute set data structures into their own header file.Nicolas B. Pierron1-64/+1
This modification moves Attr and Bindings structures into their own header file which is dedicated to the attribute set representation. The goal of to isolate pieces of code which are related to the attribute set representation. Thus future modifications of the attribute set representation will only have to modify these files, and not every other file across the evaluator.
2015-03-19 Fix Boehm API violationEelco Dolstra1-0/+4
We were calling GC_INIT() after doing an allocation (in the baseEnv construction), which is not allowed.
2015-02-23 Add restricted evaluation modeEelco Dolstra1-0/+6
If ‘--option restrict-eval true’ is given, the evaluator will throw an exception if an attempt is made to access any file outside of the Nix search path. This is primarily intended for Hydra, where we don't want people doing ‘builtins.readFile ~/.ssh/id_dsa’ or stuff like that.
2015-01-15 Fix assertion failure in nix-envEelco Dolstra1-3/+5
$ nix-env -f ~/Dev/nixops/ -iA foo nix-env: src/libexpr/eval.hh:57: void nix::Bindings::push_back(const nix::Attr&): Assertion `size_ < capacity' failed. Aborted
2015-01-07 Show position info for failing <...> lookupsEelco Dolstra1-1/+1
2014-12-12 Remove canary stuffEelco Dolstra1-8/+0
2014-11-25 forceString(): Accept pos argumentEelco Dolstra1-1/+1
2014-11-15 Add functors (callable attribute sets).Shea Levy1-1/+1
With this, attribute sets with a `__functor` attribute can be applied just like normal functions. This can be used to attach arbitrary metadata to a function without callers needing to treat it specially.
2014-10-20 Fix build on gcc < 4.7Shea Levy1-0/+3
2014-10-17 Export realiseContext in libnixexprShea Levy1-0/+8
Useful for importNative plugins
2014-09-24 Bindings: Remove copy constructorEelco Dolstra1-2/+3
2014-09-22 Rename strictForceValue -> forceValueDeepEelco Dolstra1-1/+1
2014-09-22 Add a function ‘valueSize’Eelco Dolstra1-2/+3
It returns the size of value, including all other values and environments reachable from it. It is intended for debugging memory consumption issues.
2014-09-19 Inline Bindings::find()Eelco Dolstra1-1/+8
2014-09-19 Store Attrs inside BindingsEelco Dolstra1-24/+48
This prevents a double allocation per attribute set.
2014-09-17 Add some instrumentation for debugging GC leaksEelco Dolstra1-0/+8
2014-08-21 Fix a segfault in ‘nix-env -qa’Eelco Dolstra1-1/+1
This was triggered by 47e185847e729d49e6aa376e8299fd66ef834a0a, which turned globals.state into a pointer.
2014-05-26 Make the Nix search path declarativeEelco Dolstra1-1/+4
Nix search path lookups like <nixpkgs> are now desugared to ‘findFile nixPath <nixpkgs>’, where ‘findFile’ is a new primop. Thus you can override the search path simply by saying let nixPath = [ { prefix = "nixpkgs"; path = "/my-nixpkgs"; } ]; in ... <nixpkgs> ... In conjunction with ‘scopedImport’ (commit c273c15cb13bb86420dda1e5341a4e19517532b5), the Nix search path can be propagated across imports, e.g. let overrides = { nixPath = [ ... ] ++ builtins.nixPath; import = fn: scopedImport overrides fn; scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; builtins = builtins // overrides; }; in scopedImport overrides ./nixos
2014-05-26 Ensure that -I flags get included in nixPathEelco Dolstra1-2/+1
Also fixes #261.
2014-05-26 Add primop ‘scopedImport’Eelco Dolstra1-0/+1
‘scopedImport’ works like ‘import’, except that it takes a set of attributes to be added to the lexical scope of the expression, essentially extending or overriding the builtin variables. For instance, the expression scopedImport { x = 1; } ./foo.nix where foo.nix contains ‘x’, will evaluate to 1. This has a few applications: * It allows getting rid of function argument specifications in package expressions. For instance, a package expression like: { stdenv, fetchurl, libfoo }: stdenv.mkDerivation { ... buildInputs = [ libfoo ]; } can now we written as just stdenv.mkDerivation { ... buildInputs = [ libfoo ]; } and imported in all-packages.nix as: bar = scopedImport pkgs ./bar.nix; So whereas we once had dependencies listed in three places (buildInputs, the function, and the call site), they now only need to appear in one place. * It allows overriding builtin functions. For instance, to trace all calls to ‘map’: let overrides = { map = f: xs: builtins.trace "map called!" (map f xs); # Ensure that our override gets propagated by calls to # import/scopedImport. import = fn: scopedImport overrides fn; scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; # Also update ‘builtins’. builtins = builtins // overrides; }; in scopedImport overrides ./bla.nix * Similarly, it allows extending the set of builtin functions. For instance, during Nixpkgs/NixOS evaluation, the Nixpkgs library functions could be added to the default scope. There is a downside: calls to scopedImport are not memoized, unlike import. So importing a file multiple times leads to multiple parsings / evaluations. It would be possible to construct the AST only once, but that would require careful handling of variables/environments.
2014-04-04 Show position info in Boolean operationsEelco Dolstra1-1/+2
2014-04-04 Show position info in string concatenation / addition errorsEelco Dolstra1-2/+2
2014-04-04 forceString: Show position infoEelco Dolstra1-2/+2
2014-04-04 forceAttrs: Show position infoEelco Dolstra1-0/+1
2014-04-04 forceList: Show position infoEelco Dolstra1-1/+2
2014-04-04 forceInt: Show position infoEelco Dolstra1-1/+1
2014-04-04 Pass position information to primop callsEelco Dolstra1-3/+3
For example: error: `tail' called on an empty list, at /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/ex-2/default.nix:13:7
2014-04-04 Include position info in function applicationEelco Dolstra1-1/+1
This allows error messages like: error: the anonymous function at `/etc/nixos/configuration.nix:1:1' called without required argument `foo', at `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/lib/modules.nix:77:59'
2014-03-05 Revert "Make ifs and asserts tail-recursive"Eelco Dolstra1-1/+0
This reverts commit 273322c7732093a354e86df82cf75d6604b8bce8.
2014-02-26 Warn about missing -I pathsEelco Dolstra1-1/+1
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-01-21 Fix some clang warningsEelco Dolstra1-8/+6
2013-11-19 Add a toJSON primopEelco Dolstra1-0/+2
2013-11-18 Add a primop unsafeGetAttrPos to return the position of an attributeEelco Dolstra1-0/+1