1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00
nixpkgs/lib
aszlig 98faa0c8f3
lib/types: Set name of types.package to "package"
Nobody seems to have noticed this (except @Profpatsch) that options with
a "package" type do not get included in the manual.

So debugging this was a bit more involving because while generating the
manual there is an optionList' attribute built from the collected
attributes of all the option declarations.

Up to that point everything is fine except if it comes to
builtins.toXML, where attributes with { type = "derivation" } won't get
included, for example see here:

nix-repl> builtins.toXML { type = "derivation"; foo = "bar"; }
"<?xml version='1.0' encoding='utf-8'?>\n<expr>\n  <derivation>
 <repeated />\n  </derivation>\n</expr>\n"

nix-repl> builtins.toXML { type = "somethingelse"; foo = "bar"; }
"<?xml version='1.0' encoding='utf-8'?>\n<expr>\n  <attrs>
     <attr name=\"foo\">\n      <string value=\"bar\" />\n    </attr>
     <attr name=\"type\">\n      <string value=\"somethingelse\" />
     </attr>\n </attrs>\n</expr>\n"

The following function in libexpr/eval.cc (Nix) is responsible for toXML
dropping the attributes:

bool EvalState::isDerivation(Value & v)
{
    if (v.type != tAttrs) return false;
    Bindings::iterator i = v.attrs->find(sType);
    if (i == v.attrs->end()) return false;
    forceValue(*i->value);
    if (i->value->type != tString) return false;
    return strcmp(i->value->string.s, "derivation") == 0;
}

So I've renamed this now to "package" which is not only more consistent
with the option type but also shouldn't cause similar issues anymore.

Tested this on base of b60ceea, because building the dependencies on
recent libc/staging changes on master took too long.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Reported-by: Profpatsch <mail@profpatsch.de>
2016-02-17 21:12:24 +01:00
..
tests NixOS modules: Add error context on module arguments evaluation. 2015-07-14 15:07:54 +02:00
attrsets.nix Revert "Merge #12357: nixos docs: show references to packages" 2016-02-03 12:16:33 +01:00
composable-derivation.nix Shea told me composableDerivation is hard to understand. 2014-04-30 20:31:40 +02:00
customisation.nix lib: add makeScope 2015-09-27 09:45:23 -05:00
debug.nix lib: cleanup a little bit, add traceIf 2015-03-26 12:43:42 +00:00
default.nix cherry-pick lib.sandbox into master 2015-11-19 11:33:21 -08:00
deprecated.nix Update deprecated.nix 2015-11-15 03:41:39 +08:00
licenses.nix licenses: add non-commercial Creative Commons 2015-12-22 02:25:43 +01:00
lists.nix Use builtins.sort 2015-07-28 18:42:22 +02:00
maintainers.nix Merge pull request #12922 from igsha/dirac 2016-02-17 10:17:59 +00:00
meta.nix Make appendToName do the right thing 2014-03-10 15:01:56 +01:00
minver.nix Expose minimum required Nix version. 2015-11-26 23:11:11 +08:00
modules.nix Factor out option renaming 2015-10-14 18:18:47 +02:00
options.nix Add read-only options 2015-07-30 13:44:50 +02:00
platforms.nix add armv7l-linux to mesaPlatforms 2016-02-14 23:45:32 +01:00
sandbox.nix cherry-pick lib.sandbox into master 2015-11-19 11:33:21 -08:00
sources.nix Manual: Handle XML files in subdirectories 2014-08-25 14:33:33 +02:00
strings-with-deps.nix Replace hasAttr/getAttr calls with the ? and . operators 2014-10-05 01:11:06 +02:00
strings.nix lib.getVersion: extend the function to cope with strings as well as derivations 2016-01-05 20:09:39 +01:00
systems.nix lib: Use arithmetic operators rather than builtins.add etc. 2014-10-05 01:10:06 +02:00
tests.nix add helper to lib/attrsets: hasAttrByPath 2015-12-07 11:04:14 +01:00
trivial.nix lib/trivial.nix: improve spelling 2015-11-25 11:30:43 +01:00
types.nix lib/types: Set name of types.package to "package" 2016-02-17 21:12:24 +01:00