Commit Graph

30 Commits

Author SHA1 Message Date
Tom Saeger
5989515b94 lib: trivial spelling fixes 2017-04-19 19:37:55 -05:00
John Ericson
fffcee35f9 lib: Fix matchAttrs 2017-04-17 17:13:01 -04:00
John Ericson
4c0d7da183 Get rid of all with { inherit... } and just used let inherit...
The old forms presumably predates, or were made in ignorance of,
`let inherit`. This way is better style as the scoping as more lexical,
something which Nix can (or might already!) take advantage of.
2017-03-30 03:05:05 -04:00
Franz Pletz
67332d4e4c
lib: fix typo 2016-12-04 01:39:51 +01:00
Eelco Dolstra
1c043e0749 toDerivation: Provide "out" and "outputName" attributes 2016-09-19 20:02:07 +02:00
Tuomas Tynkkynen
e0b5eef4e7 lib.chooseDevOutputs: Use lib.getDev
Reduces duplication, plus is actually needed for Go packages (at least
go-repo-root).
2016-09-12 00:18:18 +03:00
Tuomas Tynkkynen
5326e85f3d stdenv.mkDerivation: Use chooseDevOutputs 2016-08-29 14:49:51 +03:00
Eelco Dolstra
532211c68d Really remove library functions
Throwing a message like "removed 2016-02-29 because unused and broken"
is unhelpful because it doesn't show what function was removed.
2016-07-11 16:34:46 +02:00
Nikolay Amiantov
5ff40ddedf add get* helper functions and mass-replace manual outputs search with them 2016-04-25 13:24:39 +03:00
Nikolay Amiantov
7d3e75827b getOutput function: init 2016-04-25 13:22:41 +03:00
Nikolay Amiantov
5f3987f44f Revert "tryAttrs: init function"
This reverts commit 338340f993563551d8cb45941da987408abef65f.
2016-04-25 13:22:41 +03:00
Nikolay Amiantov
338340f993 tryAttrs: init function 2016-04-13 22:05:45 +03:00
zimbatm
523e328318 lib/attrsets: document all the functions 2016-03-09 19:59:57 +00:00
zimbatm
a086858ef5 Remove lib.deepSeqList and lib.deepSeqAttrs
Both functions are broken and unused in the repo.
2016-03-09 19:59:57 +00:00
Vladimír Čunát
889351af8b Revert "Merge #12357: nixos docs: show references to packages"
The PR wasn't good enough yet.
This reverts commit b2a37ceeea8c38ec71447f8dae1e6890a8cf982d, reversing
changes made to 7fa9a1abce623aaf18b22f5dca3fc8a44a494e8d.
2016-02-03 12:16:33 +01:00
Vladimír Čunát
b9f6dfe8c5 nixos manuals: allow displaying package references
The manuals are now evaluated with each derivation in `pkgs` (recursively)
replaced by a fake with path "\${pkgs.path.to.the.attribute}".
It isn't perfect, but it seems to cover a vast majority of use cases.
Caveat: even if the package is reached by a different means,
the path above will be shown and not e.g. `${config.services.foo.package}`.

As before, defaults created by `mkDefault` aren't displayed,
but documentation shouldn't (mostly) be a reason to use that anymore.

Note: t wouldn't be enough to just use `lib.mapAttrsRecursive`,
because derivations are also (special) attribute sets.
2016-01-13 12:03:18 +01:00
Christian Zagrodnick
ce96057588 add helper to lib/attrsets: hasAttrByPath 2015-12-07 11:04:14 +01:00
Eelco Dolstra
45c7dd7d98 Add stdenv bootstrap tools generation to release.nix 2015-10-23 13:05:36 +02:00
Jaka Hudoklin
341ac85644 Add lib.filterAttrsRecursive function 2015-09-19 00:33:44 +02:00
Eelco Dolstra
214d4fb73c Allow options with type "package" to be store paths
For example, this allows writing

  nix.package = /nix/store/786mlvhd17xvcp2r4jmmay6jj4wj6b7f-nix-1.10pre4206_896428c;

Also, document types.package in the manual.
2015-08-07 03:09:57 +02:00
Eelco Dolstra
0ae8b365b3 Rename misc.nix -> deprecated.nix 2015-07-23 18:31:54 +02:00
Eelco Dolstra
3cd5fd8bb3 More efficient version of filterAttrs 2015-07-23 16:49:13 +02:00
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
2014-12-30 15:07:29 -08:00
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.
2014-10-05 01:11:06 +02:00
Eelco Dolstra
0e120dc68f Use new primops 2014-10-05 01:10:52 +02:00
Eelco Dolstra
a8b693fef7 Remove backward-compatible implementations of some primops
Nixpkgs requires at least Nix 1.2 anyway, so these are now useless.
2013-11-12 13:50:45 +01:00
Eelco Dolstra
785eaf2cea Add some primops to lib 2013-11-12 13:48:30 +01:00
Eelco Dolstra
b479dac8df Inline some functions on the critical path 2013-10-28 22:45:55 +01:00
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.
2013-10-28 22:45:55 +01:00
Eelco Dolstra
5fef92c4a0 Move pkgs/lib/ to lib/ 2013-10-10 13:28:21 +02:00