Benjamin Staffin
b3a534d3d2
lib: Fix matchAttrs by importing builtins.length
...
Before:
nix-repl> :l <nixpkgs>
nix-repl> lib.matchAttrs { foo = "bar"; } { bar = "bas"; }
error: undefined variable ‘length’ at "/home/benley/nix/nixpkgs/lib/attrsets.nix":317:10
After:
nix-repl> :l <nixpkgs>
nix-repl> lib.matchAttrs { foo = "bar"; } { bar = "bas"; }
false
Change-Id: I548d69d50cffe1c63a6f39f76fd09d1835d8d9a2
10 years ago
Benjamin Staffin
4dd93dbf25
lib: Fix matchAttrs by importing builtins.length
...
Before:
nix-repl> :l <nixpkgs>
nix-repl> lib.matchAttrs { foo = "bar"; } { bar = "bas"; }
error: undefined variable ‘length’ at "/home/benley/nix/nixpkgs/lib/attrsets.nix":317:10
After:
nix-repl> :l <nixpkgs>
nix-repl> lib.matchAttrs { foo = "bar"; } { bar = "bas"; }
false
Change-Id: I548d69d50cffe1c63a6f39f76fd09d1835d8d9a2
10 years ago
Eelco Dolstra
97220c973f
Replace hasAttr/getAttr calls with the ? and . operators
...
For NixOS evaluation, this gives a ~21% reduction in the number of
values allocated and a ~4% speedup. It's also more readable.
10 years ago
Eelco Dolstra
0e120dc68f
Use new primops
10 years ago
Eelco Dolstra
a8b693fef7
Remove backward-compatible implementations of some primops
...
Nixpkgs requires at least Nix 1.2 anyway, so these are now useless.
11 years ago
Eelco Dolstra
785eaf2cea
Add some primops to lib
11 years ago
Eelco Dolstra
b479dac8df
Inline some functions on the critical path
11 years ago
Eelco Dolstra
40913958a2
Keep position information for option declarations and definitions
...
Also, when an option definition fails to type-check, print the file
name of the module in which the offending definition occurs, e.g.
error: user-thrown exception: The option value `boot.loader.grub.version' in `/etc/nixos/configuration.nix' is not a integer.
11 years ago
Eelco Dolstra
5fef92c4a0
Move pkgs/lib/ to lib/
11 years ago
Evgeny Egorochkin
fcbc4fe9ff
Deprecate lib.zip in favor of lib.zipAttrsWith.
...
Add deprecation trace message.
Nixos has been ported away from lib.zip in d705c0c3a4b84768907ade90b3f420d62db422a2.
11 years ago
Eelco Dolstra
5e83e93e97
Add a library function ‘genAttrs’
...
It generates an attribute set by mapping a function over a list of
attribute names.
11 years ago
Shea Levy
da3be9c6b2
Add deepSeq lib function
12 years ago
Eelco Dolstra
a05198b6ea
Typos
12 years ago
Eelco Dolstra
56cee6fe5c
Make Firefox 16 the default
12 years ago
Marc Weber
aa583c8cf4
experimental/lib-fold-attr
...
adding useful function foldAttr which behave like fold on attr values grouped by name
(without assertions now)
Signed-off-by: Marc Weber <marco-oweber@gmx.de>
12 years ago
Eelco Dolstra
37159c1b9a
Remove obsolete eqStrict function
...
Use the "==" operator instead.
12 years ago
Eelco Dolstra
431c55cbf1
Use builtin filter, elem, concatLists functions if available
12 years ago
Eelco Dolstra
3bf4437622
Remove obsolete backwards compatibility hack for getAttr
12 years ago
Eelco Dolstra
4b5c1dec62
* Add a function ‘mapAttrsToList’ that maps a function over the
...
attributes in a set, returning a list. (Note that the regular
‘mapAttrs’ returns an attribute set.)
svn path=/nixpkgs/trunk/; revision=34509
12 years ago
Eelco Dolstra
89af9f3f4c
* Add a variant of mapAttrs that allows rewriting the name of each
...
attribute in addition to the value.
svn path=/nixpkgs/trunk/; revision=34246
12 years ago
Eelco Dolstra
e78a048265
* Add a function "filterAttrs" and clean up some comments.
...
svn path=/nixpkgs/trunk/; revision=33626
12 years ago
Eelco Dolstra
efe6fddd59
* Indentation.
...
svn path=/nixpkgs/trunk/; revision=30193
13 years ago
Michael Raskin
aadb898a0b
Implementing a fix allowing deepOverride without changing dependency-tree-leaf packages
...
svn path=/nixpkgs/trunk/; revision=22533
14 years ago
Eelco Dolstra
11c3e92738
* Bring back Emacs 22 by request from Ludovic.
...
svn path=/nixpkgs/trunk/; revision=18529
15 years ago
Nicolas Pierron
56ed820f84
Add systems.nix give more control over the increasing list of supported
...
systems. This is not yet used because it has to be integrated with the
current system.
svn path=/nixpkgs/branches/stdenv-updates/; revision=18468
15 years ago
Eelco Dolstra
519e7870b6
* Move `modifyDerivation' from build-support/vm to lib and rename it
...
to `overrideDerivation'.
svn path=/nixpkgs/trunk/; revision=18466
15 years ago
Eelco Dolstra
aa392c3aa7
* Move functions like `runCommand' out of all-packages.nix and into
...
build-support/.
svn path=/nixpkgs/trunk/; revision=18465
15 years ago
Nicolas Pierron
3872882e93
Fix collect example.
...
svn path=/nixpkgs/trunk/; revision=17510
15 years ago
Nicolas Pierron
00127bef3f
Move zip & zipWithNames from misc.nix to attrsets.nix and rename them to
...
zipAttrs*.
Add recursiveUpdate functions based on zipAttrs.
svn path=/nixpkgs/trunk/; revision=17506
15 years ago
Nicolas Pierron
b3b40ebf79
Add setAttrByPath:
...
- used to defined an attribute with its path as a list of attribute names.
svn path=/nixpkgs/trunk/; revision=17480
15 years ago
Eelco Dolstra
5b7f46ea43
* A utility function `optionalAttrs', similar to optional and
...
optionalString but for attribute sets.
svn path=/nixpkgs/trunk/; revision=17002
15 years ago
Nicolas Pierron
0f6a67814a
Add 'collect' a function which recursively collects all attribute values verifying a predicate.
...
svn path=/nixpkgs/trunk/; revision=15936
15 years ago
Eelco Dolstra
1635ec4bdf
* Put strings-with-deps in lib.
...
svn path=/nixpkgs/trunk/; revision=15729
15 years ago
Eelco Dolstra
8d7bf1a11e
* Typo.
...
svn path=/nixpkgs/trunk/; revision=15699
15 years ago
Marc Weber
ed69e9ed94
getAttr can call builtins.getAttr
...
svn path=/nixpkgs/trunk/; revision=15694
15 years ago
Marc Weber
f7f938a1d1
big breaking change: renaming lib.getAttr to lib.attrByPath
...
getAttr was ambiguous. It's also a builtin function
fix
svn path=/nixpkgs/trunk/; revision=15692
15 years ago
Eelco Dolstra
671d53dd35
* Allow the user to install stdenv (nix-env -i stdenv) and get all the
...
packages in the stdenv as propagated user environment packages.
svn path=/nixpkgs/branches/stdenv-updates/; revision=15300
15 years ago
Eelco Dolstra
6b24d7bebe
* `mapAttrsRecursiveCond', which is like `mapAttrsRecursive' but takes
...
a predicate to tell it whether to recursive into a given attribute
set.
svn path=/nixpkgs/trunk/; revision=14776
15 years ago
Eelco Dolstra
b53ef57554
* Moved mapAttrs to attrsets.nix.
...
* Added a function mapAttrsRecursive, which is like mapAttrs, but
recursively applies itself to attribute sets.
* Commented and cleaned up some functions.
svn path=/nixpkgs/trunk/; revision=14495
16 years ago
Marc Weber
5ddfa7ed64
moved catAttrs, attrVals into attrsets.nix, adding attrValues
...
svn path=/nixpkgs/trunk/; revision=14425
16 years ago
Eelco Dolstra
599015e8b0
* Split lib/default.nix into several files, as it had become a big
...
mess. Also cleaned up some functions:
- foldl appeared broken (it recursively called fold).
- Renamed logicalAND/logicalOR to and/or.
- Removed listOfListsToAttrs, eqStrings: obsolete.
- Removed isInList, which does the same thing as elem.
- stringToCharacters: don't return a "" at the end of the list.
- Renamed concatList to concat, as concatList (singular) is a
misnomer: it takes two lists. Likewise, renamed mergeAttr to
mergeAttrs.
misc.nix still contains a lot of stuff that should be refactored and
moved to other files.
svn path=/nixpkgs/trunk/; revision=14013
16 years ago