about summary refs log tree commit diff
path: root/src/libexpr/primops.cc
AgeCommit message (Collapse)AuthorFilesLines
2016-10-26 Fix SIGFPE from integer overflow during divisionTuomas Tynkkynen1-3/+9
On some architectures (like x86_64 or i686, but not ARM for example) overflow during integer division causes a crash due to SIGFPE. Reproduces on a 64-bit system with: nix-instantiate --eval -E '(-9223372036854775807 - 1) / -1' The only way this can happen is when the smallest possible integer is divided by -1, so just special-case that.
2016-10-19 fixup! replace own regex class with std::regexAlexander Ried1-1/+4
2016-10-18 replace own regex class with std::regexAlexander Ried1-11/+10
2016-09-21 printMsg(lvlError, ...) -> printError(...) etc.Eelco Dolstra1-2/+2
2016-09-14 Enable HTTP/2 supportEelco Dolstra1-1/+1
The binary cache store can now use HTTP/2 to do lookups. This is much more efficient than HTTP/1.1 due to multiplexing: we can issue many requests in parallel over a single TCP connection. Thus it's no longer necessary to use a bunch of concurrent TCP connections (25 by default). For example, downloading 802 .narinfo files from https://cache.nixos.org/, using a single TCP connection, takes 11.8s with HTTP/1.1, but only 0.61s with HTTP/2. This did require a fairly substantial rewrite of the Downloader class to use the curl multi interface, because otherwise curl wouldn't be able to do multiplexing for us. As a bonus, we get connection reuse even with HTTP/1.1. All downloads are now handled by a single worker thread. Clients call Downloader::enqueueDownload() to tell the worker thread to start the download, getting a std::future to the result.
2016-08-29 forceBool(): Show position infoEelco Dolstra1-9/+10
2016-08-29 Add builtin function "partition"Eelco Dolstra1-0/+35
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-17 Add a mechanism for derivation attributes to reference the derivation's outputsEelco Dolstra1-0/+14
For example, you can now say: configureFlags = "--prefix=${placeholder "out"} --includedir=${placeholder "dev"}"; The strings returned by the ‘placeholder’ builtin are replaced at build time by the actual store paths corresponding to the specified outputs. Previously, you had to work around the inability to self-reference by doing stuff like: preConfigure = '' configureFlags+=" --prefix $out --includedir=$dev" ''; or rely on ad-hoc variable interpolation semantics in Autoconf or Make (e.g. --prefix=\$(out)), which doesn't always work.
2016-08-16 Merge pull request #1031 from abbradar/replacestrings-contextEelco Dolstra1-7/+17
Allow contexted strings in replaceStrings
2016-08-16 Allow contexted strings in replaceStringsNikolay Amiantov1-7/+17
2016-08-15 builtins.fetch{url,tarball}: Allow name attributeShea Levy1-4/+7
2016-07-26 makeFixedOutputPath(): Drop superfluous HashType argumentEelco Dolstra1-1/+1
2016-07-26 builtins.{fetchurl,fetchTarball}: Support a sha256 attributeEelco Dolstra1-3/+7
Also, allow builtins.{fetchurl,fetchTarball} in restricted mode if a hash is specified.
2016-06-01 Make the store directory a member variable of StoreEelco Dolstra1-10/+10
2016-05-04 Cleanup: Remove singleton()Eelco Dolstra1-7/+6
2016-04-25 Improved logging abstractionEelco Dolstra1-4/+4
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 the search path lazier with non-fatal errorsEelco Dolstra1-11/+12
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-0/+15
This way we don't have to put all primops in one giant file.
2016-03-04 Propagate path context via builtins.readFileNikolay Amiantov1-1/+1
2016-02-29 Add an HTTP binary cache storeEelco Dolstra1-1/+1
Allowing stuff like NIX_REMOTE=https://cache.nixos.org nix-store -qR /nix/store/x1p1gl3a4kkz5ci0nfbayjqlqmczp1kq-geeqie-1.1 or NIX_REMOTE=https://cache.nixos.org nix-store --export /nix/store/x1p1gl3a4kkz5ci0nfbayjqlqmczp1kq-geeqie-1.1 | nix-store --import
2016-02-12 Merge pull request #762 from ctheune/ctheune-floatsEelco Dolstra1-7/+34
Implement floats
2016-02-04 Eliminate the "store" global variableEelco Dolstra1-29/+28
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-07 Fix some signedness warningsEelco Dolstra1-1/+1
2016-01-05 Better error messageFabian Schmitthenner1-1/+1
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 manual: document builtins.functionArgsVladimír Čunát1-1/+1
The text is just a conversion of comment from src/libexpr/primops.cc
2016-01-05 First hit at providing support for floats in the language.Christian Theune1-7/+34
2015-07-28 Add sort primopEelco Dolstra1-1/+36
2015-07-28 Add primop genListEelco Dolstra1-0/+20
This can be used to implement functions like ‘imap’ (or for that matter, ‘map’) without the quadratic complexity incurred by calling ‘++’ repeatedly.
2015-07-24 Add replaceStrings primopEelco Dolstra1-1/+37
This is a generalisation of replaceChars in Nixpkgs.
2015-07-24 Add concatStringsSep as a primopEelco Dolstra1-0/+21
This fixes the quadratic behaviour of concatStrings/concatStringsSep in Nixpkgs.
2015-07-23 Optimize small listsEelco Dolstra1-58/+58
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 Add primops all and anyEelco Dolstra1-0/+33
These are used thousands of times during NixOS evaluation, so it's useful to speed them up.
2015-07-23 Importing derivations: Add name attribute to make a valid drvShea Levy1-1/+3
2015-07-23 Allow derivations-as-srcs in the context of builtins.toFile filesShea Levy1-2/+6
2015-07-23 Add foldl' primopEelco Dolstra1-0/+24
2015-07-17 OCD: foreach -> C++11 ranged forEelco Dolstra1-50/+45
2015-06-01 Fix fetchurl/fetchTarballEelco Dolstra1-1/+2
2015-06-01 readFile: Check against nul bytesEelco Dolstra1-1/+4
2015-05-05 Allow URLs in the Nix search pathEelco Dolstra1-85/+3
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=https://github.com/NixOS/nixpkgs/archive/63def04891a0abc328b1b0b3a78ec02c58f48583.tar.gz
2015-04-09 Use cached result if there is a network errorEelco Dolstra1-7/+12
2015-04-09 Move curl stuff into a separate fileEelco Dolstra1-112/+6
2015-04-09 Implement a TTL on cached fetchurl/fetchTarball resultsEelco Dolstra1-13/+24
This is because we don't want to do HTTP requests on every evaluation, even though we can prevent a full redownload via the cached ETag. The default is one hour.
2015-04-09 Implement caching of fetchurl/fetchTarball resultsEelco Dolstra1-14/+119
ETags are used to prevent redownloading unchanged files.
2015-03-25 Add fetchTarball builtinEelco Dolstra1-0/+119
This function downloads and unpacks the given URL at evaluation time. This is primarily intended to make it easier to deal with Nix expressions that have external dependencies. For instance, to fetch Nixpkgs 14.12: with import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-14.12.tar.gz) {}; Or to fetch a specific revision: with import (fetchTarball https://github.com/NixOS/nixpkgs/archive/2766a4b44ee6eafae03a042801270c7f6b8ed32a.tar.gz) {}; This patch also adds a ‘fetchurl’ builtin that downloads but doesn't unpack its argument. Not sure if it's useful though.
2015-03-25 addToStore(): Take explicit name argumentEelco Dolstra1-1/+1
2015-03-24 Don't rely on __noChroot for corepkgsEelco Dolstra1-2/+5
This doesn't work anymore if the "strict" chroot mode is enabled. Instead, add Nix's store path as a dependency. This ensures that its closure is present in the chroot.
2015-03-06 Fix typos: s/the the/the/Daniel Hahler1-1/+1
2015-02-23 Add restricted evaluation modeEelco Dolstra1-7/+21
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-02-05 Remove tabEelco Dolstra1-1/+1
2015-01-29 Merge remote-tracking branch 'shlevy/baseNameOf-no-copy'Shea Levy1-1/+1
baseNameOf: Don't copy paths to the store first