about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
AgeCommit message (Collapse)AuthorFilesLines
2017-10-30 Add option allowed-urisEelco Dolstra1-0/+20
This allows network access in restricted eval mode.
2017-10-29 nix repl :t: Indicate strings that have a contextEelco Dolstra1-1/+1
2017-07-30 Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim1-17/+17
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-07-03 Replace a few bool flags with enumsEelco Dolstra1-0/+1
Functions like copyClosure() had 3 bool arguments, which creates a severe risk of mixing up arguments. Also, implement copyClosure() using copyPaths().
2017-05-16 Improve progress indicatorEelco Dolstra1-1/+1
2017-04-14 Shut up some warningsEelco Dolstra1-1/+1
2017-02-22 Explicitly model all settings and fail on unrecognized onesDan Peebles1-1/+1
Previously, the Settings class allowed other code to query for string properties, which led to a proliferation of code all over the place making up new options without any sort of central registry of valid options. This commit pulls all those options back into the central Settings class and removes the public get() methods, to discourage future abuses like that. Furthermore, because we know the full set of options ahead of time, we now fail loudly if someone enters an unrecognized option, thus preventing subtle typos. With some template fun, we could probably also dump the full set of options (with documentation, defaults, etc.) to the command line, but I'm not doing that yet here.
2017-01-26 Add support for passing structured data to buildersEelco Dolstra1-0/+2
Previously, all derivation attributes had to be coerced into strings so that they could be passed via the environment. This is lossy (e.g. lists get flattened, necessitating configureFlags vs. configureFlagsArray, of which the latter cannot be specified as an attribute), doesn't support attribute sets at all, and has size limitations (necessitating hacks like passAsFile). This patch adds a new mode for passing attributes to builders, namely encoded as a JSON file ".attrs.json" in the current directory of the builder. This mode is activated via the special attribute __structuredAttrs = true; (The idea is that one day we can set this in stdenv.mkDerivation.) For example, stdenv.mkDerivation { __structuredAttrs = true; name = "foo"; buildInputs = [ pkgs.hello pkgs.cowsay ]; doCheck = true; hardening.format = false; } results in a ".attrs.json" file containing (sans the indentation): { "buildInputs": [], "builder": "/nix/store/ygl61ycpr2vjqrx775l1r2mw1g2rb754-bash-4.3-p48/bin/bash", "configureFlags": [ "--with-foo", "--with-bar=1 2" ], "doCheck": true, "hardening": { "format": false }, "name": "foo", "nativeBuildInputs": [ "/nix/store/10h6li26i7g6z3mdpvra09yyf10mmzdr-hello-2.10", "/nix/store/4jnvjin0r6wp6cv1hdm5jbkx3vinlcvk-cowsay-3.03" ], "propagatedBuildInputs": [], "propagatedNativeBuildInputs": [], "stdenv": "/nix/store/f3hw3p8armnzy6xhd4h8s7anfjrs15n2-stdenv", "system": "x86_64-linux" } "passAsFile" is ignored in this mode because it's not needed - large strings are included directly in the JSON representation. It is up to the builder to do something with the JSON representation. For example, in bash-based builders, lists/attrsets of string values could be mapped to bash (associative) arrays.
2017-01-26 Bindings: Add a method for iterating in lexicographically sorted orderEelco Dolstra1-7/+3
2016-11-26 Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra1-17/+17
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-17/+17
2016-08-29 forceBool(): Show position infoEelco Dolstra1-2/+2
2016-08-29 Add builtin function "partition"Eelco Dolstra1-0/+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-29 callFunction: Copy functors to the heapShea Levy1-4/+11
Normally it's impossible to take a reference to the function passed to callFunction, so some callers (e.g. ExprApp::eval) allocate that value on the stack. For functors, a reference to the functor itself may be kept, so we need to have it on the heap. Fixes #1045
2016-08-23 nix build: Use Nix search pathEelco Dolstra1-3/+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-06-01 Make the store directory a member variable of StoreEelco Dolstra1-2/+2
2016-04-25 Improved logging abstractionEelco Dolstra1-1/+1
This also gets rid of --log-type, since the nested log type isn't useful in a multi-threaded situation, and nobody cares about the "pretty" log type.
2016-04-14 Make $NIX_PATH parsing more robustEelco Dolstra1-5/+32
2016-04-14 Make the search path lazier with non-fatal errorsEelco Dolstra1-3/+7
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-02-12 Merge pull request #762 from ctheune/ctheune-floatsEelco Dolstra1-2/+55
Implement floats
2016-02-04 StoreAPI -> StoreEelco Dolstra1-1/+1
Calling a class an API is a bit redundant...
2016-02-04 Eliminate the "store" global variableEelco Dolstra1-1/+2
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/+9
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 Fix up float parsing.Christian Theune1-0/+1
2016-01-05 First hit at providing support for floats in the language.Christian Theune1-2/+54
2015-11-25 autoCallFunction: Auto-call functorsShea Levy1-0/+11
2015-10-29 int2String() -> std::to_string()Eelco Dolstra1-1/+1
2015-10-08 isFunctor: SimplifyEelco Dolstra1-0/+6
2015-10-08 forceFunction: allow functors as wellMathnerd3141-1/+1
2015-07-31 Fix stack consumptionEelco Dolstra1-5/+0
2015-07-31 Output line number on infinite recursionIwan Aucamp1-8/+8
2015-07-23 CleanupEelco Dolstra1-5/+0
2015-07-23 Optimize empty setsEelco Dolstra1-0/+4
This reduces the number of Bindings allocations by about 10%.
2015-07-23 Merge branch 'attr-set-hh' of https://github.com/nbp/nixEelco Dolstra1-30/+0
Conflicts: src/libexpr/eval.cc
2015-07-23 Optimize small listsEelco Dolstra1-33/+46
The value pointers of lists with 1 or 2 elements are now stored in the list value itself. In particular, this makes the "concatMap (x: if cond then [(f x)] else [])" idiom cheaper.
2015-07-17 OCD: foreach -> C++11 ranged forEelco Dolstra1-45/+45
2015-07-17 Make printValue() interruptibleEelco Dolstra1-0/+2
Fixes #572.
2015-07-14 Move attribute set data structures into their own header file.Nicolas B. Pierron1-30/+0
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-06-17 Support URLs in $NIX_PATHEelco Dolstra1-1/+13
This didn't work (despite claims in the manual), because the colon in "http://" was parsed as a element separator. So handle "://" specially.
2015-05-22 Fix import-from-derivation in restricted eval modeEelco Dolstra1-0/+7
This relaxes restricted mode to allow access to anything in the store. In the future, it would be better to allow access to only paths that have been constructed in the current evaluation (so a hard-coded /nix/store/blabla in a Nix expression would still be rejected). However, note that reading /nix/store itself is still rejected, so you can't use this so get access to things you don't know about.
2015-04-16 Fix using restricted mode with chrootsEelco Dolstra1-0/+5
2015-03-25 addToStore(): Take explicit name argumentEelco Dolstra1-1/+1
2015-03-19 Disable scanning for interior pointersEelco Dolstra1-0/+2
This may remove the "Repeated allocation of very large block" warnings.
2015-03-19 Fix Boehm API violationEelco Dolstra1-38/+42
We were calling GC_INIT() after doing an allocation (in the baseEnv construction), which is not allowed.
2015-03-19 Check return values from malloc/strdupEelco Dolstra1-11/+34
2015-03-18 Print some Boehm GC statsEelco Dolstra1-0/+7
2015-03-18 valueSize(): Take into account list/bindings/env sizeEelco Dolstra1-6/+15
2015-03-06 forceValueDeep: Add to error prefixEelco Dolstra1-2/+7
2015-03-06 Improve error messageEelco Dolstra1-11/+20
2015-02-23 Add restricted evaluation modeEelco Dolstra1-3/+20
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.