Eelco Dolstra
c10c61449f
Eliminate the "store" global variable
...
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-02-04 14:28:26 +01:00
Eelco Dolstra
5d8b7eb3e1
Revert "Revert "next try for "don't abort when given unmatched '}' with 'start-condition stack underflow'. This fixes #751 """
...
This reverts commit b669d3d2e8
.
2016-01-20 16:34:42 +01:00
Eelco Dolstra
b669d3d2e8
Revert "next try for "don't abort when given unmatched '}' with 'start-condition stack underflow'. This fixes #751 ""
...
This reverts commit ed23c8568e
. Let's
merge this *after* the 1.11.1 release.
2016-01-20 00:05:28 +01:00
Fabian Schmitthenner
ed23c8568e
next try for "don't abort when given unmatched '}' with 'start-condition stack underflow'. This fixes #751 "
...
This reverts commit 8120b6fb8a
and fixes the regression introduced in
8d22b26448
.
2016-01-19 20:35:35 +00:00
Eelco Dolstra
8120b6fb8a
Revert "don't abort when given unmatched '}' with 'start-condition stack underflow'. This fixes #751 "
...
This reverts commit 8d22b26448
. It
breaks Nixpkgs:
$ nix-env -qa
error: syntax error, unexpected IND_STR, expecting '}', at /home/eelco/Dev/nixpkgs-stable/pkgs/top-level/python-packages.nix:7605:8
2016-01-19 20:33:32 +01:00
Fabian Schmitthenner
8d22b26448
don't abort when given unmatched '}' with 'start-condition stack underflow'. This fixes #751
2016-01-12 20:40:41 +00:00
Eelco Dolstra
9aac1861f7
Fix some signedness warnings
2016-01-07 14:37:39 +01:00
Fabian Schmitthenner
39d1da7b51
Better error message
...
Also show types when nix cannot compare values of different types.
This is also more consistent since types are already shown when comparing values of the same not comparable type.
2016-01-05 14:13:54 +01:00
Shea Levy
14080f3e4b
Use __toString when coercing sets to strings.
...
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 13:55:06 +01:00
Vladimír Čunát
29c0199d5c
manual: document builtins.functionArgs
...
The text is just a conversion of comment from src/libexpr/primops.cc
2016-01-05 13:29:17 +01:00
Eelco Dolstra
a9faa7bbce
showId: Handle empty attribute names
...
We should probably disallow these, but until then, we shouldn't barf
with an assertion failure.
Fixes #738 .
2015-12-17 15:15:28 +01:00
Shea Levy
f327970129
Merge branch 'auto-call-functor'
...
autoCallFunction now auto-calls functors
2015-11-25 11:57:31 -05:00
Shea Levy
9533532ce2
autoCallFunction: Auto-call functors
2015-11-25 11:56:14 -05:00
Eelco Dolstra
cad40adce5
Merge pull request #704 from ysangkok/freebsd-support
...
FreeBSD support with knowledge about Linux emulation
2015-11-24 19:24:21 +01:00
Eelco Dolstra
5c28943e8f
int2String() -> std::to_string()
2015-10-29 13:26:55 +01:00
Eelco Dolstra
51cf4455b2
isFunctor: Simplify
2015-10-08 13:22:11 +02:00
Mathnerd314
8a87521636
forceFunction: allow functors as well
2015-10-08 13:19:44 +02:00
Manuel Jacob
12c1776df9
Don't try to link libdl on FreeBSD.
...
There is no libdl on FreeBSD. Instead the symbols are included in libc.
2015-10-06 22:28:30 +02:00
Eelco Dolstra
4ba6bc184c
Shut up clang warnings
2015-09-18 01:22:35 +02:00
Iwan Aucamp
3db950aab7
Removed unnecessary included
2015-08-03 11:48:34 +02:00
Eelco Dolstra
2bac04c5ff
Fix stack consumption
2015-07-31 20:28:25 +02:00
Iwan Aucamp
75837651f1
Output line number on infinite recursion
2015-07-31 20:26:44 +02:00
Eelco Dolstra
76cc8e97a2
Add sort primop
2015-07-28 18:39:39 +02:00
Eelco Dolstra
50807f3dd5
Add primop genList
...
This can be used to implement functions like ‘imap’ (or for that
matter, ‘map’) without the quadratic complexity incurred by calling
‘++’ repeatedly.
2015-07-28 17:28:35 +02:00
Eelco Dolstra
d6d5885c15
Add replaceStrings primop
...
This is a generalisation of replaceChars in Nixpkgs.
2015-07-24 15:32:24 +02:00
Eelco Dolstra
2e8fd4c5cd
Add concatStringsSep as a primop
...
This fixes the quadratic behaviour of concatStrings/concatStringsSep
in Nixpkgs.
2015-07-24 02:38:09 +02:00
Eelco Dolstra
cb4320c1a0
Cleanup
2015-07-23 23:14:07 +02:00
Eelco Dolstra
c8bb2371eb
Optimize empty sets
...
This reduces the number of Bindings allocations by about 10%.
2015-07-23 23:11:08 +02:00
Eelco Dolstra
19eddecc0f
Merge branch 'attr-set-hh' of https://github.com/nbp/nix
...
Conflicts:
src/libexpr/eval.cc
2015-07-23 22:16:01 +02:00
Eelco Dolstra
b83801f8b3
Optimize small lists
...
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-23 22:05:09 +02:00
Eelco Dolstra
14be783676
Add primops all and any
...
These are used thousands of times during NixOS evaluation, so it's
useful to speed them up.
2015-07-23 19:23:11 +02:00
Shea Levy
39e27a04b8
Importing derivations: Add name attribute to make a valid drv
2015-07-23 17:04:07 +02:00
Shea Levy
1ed55234d9
Allow derivations-as-srcs in the context of builtins.toFile files
2015-07-23 17:03:47 +02:00
Eelco Dolstra
61af14a921
Add foldl' primop
2015-07-23 17:03:02 +02:00
Eelco Dolstra
0a2bee307b
Make <nix/fetchurl.nix> a builtin builder
...
This ensures that 1) the derivation doesn't change when Nix changes;
2) the derivation closure doesn't contain Nix and its dependencies; 3)
we don't have to rely on ugly chroot hacks.
2015-07-20 04:38:46 +02:00
Eelco Dolstra
6bd2c7bb38
OCD: foreach -> C++11 ranged for
2015-07-17 20:13:56 +02:00
Eelco Dolstra
f39979c6d3
Make printValue() interruptible
...
Fixes #572 .
2015-07-17 11:33:39 +02:00
Nicolas B. Pierron
db21cfa688
Move attribute set data structures into their own header file.
...
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-07-14 19:23:17 +02:00
Guillaume Maudoux
467977f203
Fix the parsing of "$"'s in strings.
2015-07-03 14:09:58 +02:00
Guillaume Maudoux
65e4dcd69b
Fix the hack that resets the scanner state.
2015-07-03 13:53:36 +02:00
Eelco Dolstra
65f17cd330
Support URLs in $NIX_PATH
...
This didn't work (despite claims in the manual), because the colon in
"http://" was parsed as a element separator. So handle "://"
specially.
2015-06-17 16:20:11 +02:00
Eelco Dolstra
bc51175dc0
Add tarball tests
2015-06-01 16:18:23 +02:00
Eelco Dolstra
da196ec68f
Document tarball downloading
2015-06-01 15:14:44 +02:00
Eelco Dolstra
c1323b53e3
Fix fetchurl/fetchTarball
2015-06-01 15:08:09 +02:00
Eelco Dolstra
1c88e100e7
readFile: Check against nul bytes
2015-06-01 15:07:42 +02:00
Eelco Dolstra
920f5fd4dd
Fix import-from-derivation in restricted eval mode
...
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-05-22 12:18:23 +02:00
Eelco Dolstra
6519f06f39
nix-env/nix-instantiate/nix-build: Support URIs
...
For instance, you can install Firefox from a specific Nixpkgs revision
like this:
$ nix-env -f 63def04891
.tar.gz -iA firefox
Or build a package from the latest nixpkgs-unstable channel:
$ nix-build https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz -A hello
2015-05-06 14:54:31 +02:00
Eelco Dolstra
9451ef3731
Allow URLs in the Nix search path
...
E.g. to install "hello" from the latest Nixpkgs:
$ nix-build '<nixpkgs>' -A hello -I nixpkgs=https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz
Or to install a specific version of NixOS:
$ nixos-rebuild switch -I nixpkgs=63def04891
.tar.gz
2015-05-05 17:09:42 +02:00
Eelco Dolstra
35d30d67eb
Make downloads interruptable
2015-05-05 14:39:48 +02:00
Eelco Dolstra
035aeb9547
Fix using restricted mode with chroots
2015-04-16 18:46:17 +02:00