about summary refs log tree commit diff
path: root/src/libexpr
AgeCommit message (Collapse)AuthorFilesLines
2014-09-22 Add ‘deepSeq’ primopEelco Dolstra1-0/+11
Note that unlike ‘lib.deepSeq’ in Nixpkgs, this handles cycles.
2014-09-22 Make forceValueDeep work on values with cyclesEelco Dolstra1-9/+20
2014-09-22 Rename strictForceValue -> forceValueDeepEelco Dolstra2-4/+4
2014-09-22 Handle cycles when printing a valueEelco Dolstra1-5/+23
So this no longer crashes with a stack overflow: nix-instantiate -E --eval 'let as = { x = as; }; in as' Instead it prints: { x = { x = <CYCLE>; }; }
2014-09-22 Add ‘seq’ primopEelco Dolstra1-0/+12
2014-09-22 Add a function ‘valueSize’Eelco Dolstra4-2/+99
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 attrNames: Don't allocate duplicates of the symbolsEelco Dolstra1-6/+4
2014-09-19 Fix off-by-oneEelco Dolstra1-1/+1
2014-09-19 Inline Bindings::find()Eelco Dolstra2-10/+8
2014-09-19 Store Attrs inside BindingsEelco Dolstra6-50/+92
This prevents a double allocation per attribute set.
2014-09-18 Update spec fileEelco Dolstra1-1/+1
http://hydra.nixos.org/build/14344391
2014-09-18 Install some pkgconfig filesEelco Dolstra2-0/+12
2014-09-17 Add some instrumentation for debugging GC leaksEelco Dolstra3-0/+57
2014-09-04 Fix dependency orderingEelco Dolstra1-4/+2
2014-09-02 Fix boost::too_many_args errorEelco Dolstra1-1/+1
Fixes #333.
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-08-20 Use proper quotes everywhereEelco Dolstra10-78/+78
2014-08-20 Add some colorEelco Dolstra1-1/+1
2014-08-13 Refactor option handlingEelco Dolstra2-24/+30
2014-08-13 Fix warning about non-existant -I directoriesEelco Dolstra1-1/+1
2014-07-30 Rename nixPath to __nixPathEelco Dolstra2-3/+3
The name ‘nixPath’ breaks existing code.
2014-07-23 Remove some obsolete filesEelco Dolstra1-141/+0
2014-07-09 Fix compilation error on some versions of GCCEelco Dolstra1-0/+1
src/libexpr/primops.cc:42:8: error: looser throw specifier for 'virtual nix::InvalidPathError::~InvalidPathError()' src/libexpr/nixexpr.hh:12:1: error: overriding 'virtual nix::EvalError::~EvalError() noexcept (true)' http://hydra.nixos.org/build/12385750
2014-07-04 Add builtin function ‘fromJSON’Eelco Dolstra3-0/+167
Fixes #294.
2014-06-24 Only add the importNative primop if the ↵Shea Levy1-1/+2
allow-arbitrary-code-during-evaluation option is true (default false)
2014-06-17 Add importNative primopShea Levy2-0/+44
This can be used to import a dynamic shared object and return an arbitrary value, including new primops. This can be used both to test new primops without having to recompile nix every time, and to build specialized primops that probably don't belong upstream (e.g. a function that calls out to gpg to decrypt a nixops secret as-needed). The imported function should initialize the Value & as needed. A single import can define multiple values by creating an attrset or list, of course. An example initialization function might look like: extern "C" void initialize(nix::EvalState & state, nix::Value & v) { v.type = nix::tPrimOp; v.primOp = NEW nix::PrimOp(myFun, 1, state.symbols.create("myFun")); } Then `builtins.importNative ./example.so "initialize"` will evaluate to the primop defined in the myFun function.
2014-06-12 Drop ImportError and FindErrorEelco Dolstra2-6/+0
We're not catching these anywhere.
2014-06-12 findFile: Realise the context of the path attributesShea Levy2-18/+45
2014-06-12 Share code between scopedImport and importShea Levy1-42/+44
In addition to reducing duplication, this fixes both import from derivation and import of derivation for scopedImport
2014-06-10 == operator: Ignore string contextEelco Dolstra2-12/+3
There really is no case I can think of where taking the context into account is useful. Mostly it's just very inconvenient.
2014-05-29 Sort nixPath attributesEelco Dolstra1-0/+1
2014-05-26 Use std::unordered_setEelco Dolstra1-9/+2
2014-05-26 Remove ExprBuiltinEelco Dolstra4-35/+8
It's slower than ExprVar since it doesn't compute a static displacement. Since we're not using the throw primop in the implementation of <...> anymore, it's also not really needed.
2014-05-26 Make the Nix search path declarativeEelco Dolstra5-16/+49
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 Dolstra5-11/+9
Also fixes #261.
2014-05-26 Add constant ‘nixPath’Eelco Dolstra1-0/+11
It contains the Nix expression search path as a list of { prefix, path } sets, e.g. [ { path = "/nix/var/nix/profiles/per-user/root/channels/nixos"; prefix = ""; } { path = "/etc/nixos/configuration.nix"; prefix = "nixos-config"; } { path = "/home/eelco/Dev/nix/inst/share/nix/corepkgs"; prefix = "nix"; } ]
2014-05-26 Add primop ‘scopedImport’Eelco Dolstra4-3/+34
‘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-05-26 Shut up some signedness warningsEelco Dolstra1-2/+2
2014-05-15 Provide a more useful error message when a dynamic attr lookup failsShea Levy1-2/+10
2014-04-08 If a .drv cannot be parsed, show its pathEelco Dolstra1-1/+1
Otherwise you just get ‘expected string `Derive(['’ which isn't very helpful.
2014-04-04 Show position info in attribute selection errorsEelco Dolstra3-13/+14
2014-04-04 Show position info in Boolean operationsEelco Dolstra5-31/+28
2014-04-04 Show position info in string concatenation / addition errorsEelco Dolstra6-43/+59
2014-04-04 forceString: Show position infoEelco Dolstra6-30/+46
2014-04-04 forceAttrs: Show position infoEelco Dolstra5-14/+23
2014-04-04 forceList: Show position infoEelco Dolstra5-24/+35
2014-04-04 forceInt: Show position infoEelco Dolstra3-11/+11
2014-04-04 Pass position information to primop callsEelco Dolstra4-104/+104
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 Remove unnecessary quotes around file namesEelco Dolstra1-1/+1
2014-04-04 Include position info in function applicationEelco Dolstra7-22/+45
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'