Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
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.
|
|
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 ./.)
|
|
|
|
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.
|
|
Avoids an assertion
|
|
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.
|
|
|
|
|
|
|
|
Useful for importNative plugins
|
|
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%.
|
|
|
|
This gives a ~18% speedup in NixOS evaluation (after converting
most calls to hasAttr/getAttr to dynamic attrs).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
So you can now do things like:
$ nix-env -qa '.*zip.*'
$ nix-env -qa '.*(firefox|chromium).*'
|
|
|
|
|
|
|
|
|
|
Workaround for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41174. This caused
hydra-eval-jobs to ignore SIGINT.
|
|
Note that unlike ‘lib.deepSeq’ in Nixpkgs, this handles cycles.
|
|
|
|
|
|
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>; }; }
|
|
|
|
It returns the size of value, including all other values and
environments reachable from it. It is intended for debugging memory
consumption issues.
|
|
|
|
|
|
|
|
This prevents a double allocation per attribute set.
|
|
http://hydra.nixos.org/build/14344391
|
|
|
|
|
|
|
|
Fixes #333.
|
|
This was triggered by 47e185847e729d49e6aa376e8299fd66ef834a0a, which
turned globals.state into a pointer.
|
|
|
|
|
|
|
|
|
|
The name ‘nixPath’ breaks existing code.
|