aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
AgeCommit message (Collapse)Author
2015-05-05Allow URLs in the Nix search pathEelco Dolstra
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-05-05Make downloads interruptableEelco Dolstra
2015-04-16Fix using restricted mode with chrootsEelco Dolstra
2015-04-09Use cached result if there is a network errorEelco Dolstra
2015-04-09Move curl stuff into a separate fileEelco Dolstra
2015-04-09Implement a TTL on cached fetchurl/fetchTarball resultsEelco Dolstra
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-09Implement caching of fetchurl/fetchTarball resultsEelco Dolstra
ETags are used to prevent redownloading unchanged files.
2015-03-25Add fetchTarball builtinEelco Dolstra
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-25addToStore(): Take explicit name argumentEelco Dolstra
2015-03-24Don't rely on __noChroot for corepkgsEelco Dolstra
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-19Disable scanning for interior pointersEelco Dolstra
This may remove the "Repeated allocation of very large block" warnings.
2015-03-19Fix Boehm API violationEelco Dolstra
We were calling GC_INIT() after doing an allocation (in the baseEnv construction), which is not allowed.
2015-03-19Check return values from malloc/strdupEelco Dolstra
2015-03-18Print some Boehm GC statsEelco Dolstra
2015-03-18valueSize(): Take into account list/bindings/env sizeEelco Dolstra
2015-03-06Fix typos: s/the the/the/Daniel Hahler
2015-03-06forceValueDeep: Add to error prefixEelco Dolstra
2015-03-06Improve error messageEelco Dolstra
2015-02-23Add restricted evaluation modeEelco Dolstra
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-19Merge branch 'tilde-paths' of https://github.com/shlevy/nixEelco Dolstra
2015-02-19tilde paths: The rest of the string has to start with a slash anywayShea Levy
2015-02-19tilde paths: construct the entire path at parse timeShea Levy
2015-02-19tilde paths: get HOME at parse timeShea Levy
2015-02-19Remove obsolete reference to ~ operatorEelco Dolstra
2015-02-19ExprConcatStrings: canonicalize concatenated pathsShea Levy
2015-02-19Allow the leading component of a path to be a ~Shea Levy
2015-02-05Remove tabEelco Dolstra
2015-01-29Merge remote-tracking branch 'shlevy/baseNameOf-no-copy'Shea Levy
baseNameOf: Don't copy paths to the store first
2015-01-15Fix assertion failure in nix-envEelco Dolstra
$ 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-09Fix builtins.readDir on XFSEelco Dolstra
The DT_UNKNOWN fallback code was getting the type of the wrong path, causing readDir to report "directory" as the type of every file. Reported by deepfire on IRC.
2015-01-07Show position info for failing <...> lookupsEelco Dolstra
2015-01-07Remove quotes around filenames in position infoEelco Dolstra
2014-12-14PedantryEelco Dolstra
2014-12-12Remove canary stuffEelco Dolstra
2014-12-10builtins.readFile: realise context associated with the pathShea Levy
2014-12-02Make all ExternalValueBase functions constShea Levy
2014-12-02Allow external code using libnixexpr to add typesShea Levy
Code that links to libnixexpr (e.g. plugins loaded with importNative, or nix-exec) may want to provide custom value types and operations on values of those types. For example, nix-exec is currently using sets where a custom IO value type would be more appropriate. This commit provides a generic hook for such types in the form of tExternal and the ExternalBase virtual class, which contains all functions necessary for libnixexpr's type-polymorphic functions (e.g. `showType`) to be implemented.
2014-11-25Add a primop for regular expression pattern matchingEelco Dolstra
The function ‘builtins.match’ takes a POSIX extended regular expression and an arbitrary string. It returns ‘null’ if the string does not match the regular expression. Otherwise, it returns a list containing substring matches corresponding to parenthesis groups in the regex. The regex must match the entire string (i.e. there is an implied "^<pat>$" around the regex). For example: match "foo" "foobar" => null match "foo" "foo" => [] match "f(o+)(.*)" "foooobar" => ["oooo" "bar"] match "(.*/)?([^/]*)" "/dir/file.nix" => ["/dir/" "file.nix"] match "(.*/)?([^/]*)" "file.nix" => [null "file.nix"] The following example finds all regular files with extension .nix or .patch underneath the current directory: let findFiles = pat: dir: concatLists (mapAttrsToList (name: type: if type == "directory" then findFiles pat (dir + "/" + name) else if type == "regular" && match pat name != null then [(dir + "/" + name)] else []) (readDir dir)); in findFiles ".*\\.(nix|patch)" (toString ./.)
2014-11-25forceString(): Accept pos argumentEelco Dolstra
2014-11-20import derivation: cleanupShea Levy
Before this there was a bug where a `find` was being called on a not-yet-sorted set. The code was just a mess before anyway, so I cleaned it up while fixing it.
2014-11-15realiseContext: Handle all context typesShea Levy
Avoids an assertion
2014-11-15Add functors (callable attribute sets).Shea Levy
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-31Fix more warningsEelco Dolstra
2014-10-20Fix build on gcc < 4.7Shea Levy
2014-10-20Improve printing of ASTsEelco Dolstra
2014-10-18baseNameOf: Don't copy paths to the store firstShea Levy
2014-10-17Export realiseContext in libnixexprShea Levy
Useful for importNative plugins
2014-10-09mkList: Scrub betterEelco Dolstra
Clearing v.app.right was not enough, because the length field of a list only takes 32 bits, so the most significant 32 bits of v.app.left (a.k.a. v.thunk.env) would remain. This could cause Boehm GC to interpret it as a valid pointer. This change reduces maximum RSS for evaluating the ‘tested’ job in nixos/release-small.nix from 1.33 GiB to 0.80 GiB, and runtime by about 8%.
2014-10-09TypoEelco Dolstra
2014-10-05Get rid of some unnecessary ExprConcatStrings nodes in dynamic attrsEelco Dolstra
This gives a ~18% speedup in NixOS evaluation (after converting most calls to hasAttr/getAttr to dynamic attrs).