1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 21:21:06 +00:00

Add declarations and definitions to options. This allow you to retrieve

the location of the definition with the defined value.

Filter the source location for the documentation.

svn path=/nixpkgs/trunk/; revision=17253
This commit is contained in:
Nicolas Pierron 2009-09-18 15:10:11 +00:00
parent e07f5d2a2c
commit c6267a8c9d
2 changed files with 16 additions and 0 deletions

View file

@ -207,6 +207,19 @@ rec {
addOptionMakeUp
{ name = addName name; recurseInto = recurseForOption; }
(mergeOptionDecls decls)
// {
declarations =
map (m: {
source = m.key;
value = m.options;
}) (declarationsOf name);
definitions =
map (m: {
source = m.key;
value = m.config;
}) (definitionsOf name);
}
else if all isAttrs values then
(recurseInto name modules).options
else

View file

@ -240,6 +240,9 @@ rec {
inherit (opt) name;
description = if opt ? description then opt.description else
throw "Option ${opt.name}: No description.";
declarations = map (x: toString x.source) opt.declarations;
definitions = map (x: toString x.source) opt.definitions;
}
// (if opt ? example then {inherit(opt) example;} else {})
// (if opt ? default then {inherit(opt) default;} else {});