Commit graph

16 commits

Author SHA1 Message Date
Vladimír Čunát 889351af8b Revert "Merge #12357: nixos docs: show references to packages"
The PR wasn't good enough yet.
This reverts commit b2a37ceeea, reversing
changes made to 7fa9a1abce.
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
Renamed from pkgs/lib/attrsets.nix (Browse further)