summary refs log tree commit diff
path: root/pkgs/lib/options.nix
diff options
context:
space:
mode:
authorNicolas Pierron <nicolas.b.pierron@gmail.com>2009-09-18 15:10:11 +0000
committerNicolas Pierron <nicolas.b.pierron@gmail.com>2009-09-18 15:10:11 +0000
commitc6267a8c9d4f69719ffa8117a899081e2746904f (patch)
treeda6e5ae713b0739ab94fd4b2022948d6c0c0f6d8 /pkgs/lib/options.nix
parente07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241 (diff)
downloadnixpkgs-c6267a8c9d4f69719ffa8117a899081e2746904f.tar
nixpkgs-c6267a8c9d4f69719ffa8117a899081e2746904f.tar.gz
nixpkgs-c6267a8c9d4f69719ffa8117a899081e2746904f.tar.bz2
nixpkgs-c6267a8c9d4f69719ffa8117a899081e2746904f.tar.lz
nixpkgs-c6267a8c9d4f69719ffa8117a899081e2746904f.tar.xz
nixpkgs-c6267a8c9d4f69719ffa8117a899081e2746904f.tar.zst
nixpkgs-c6267a8c9d4f69719ffa8117a899081e2746904f.zip
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
Diffstat (limited to 'pkgs/lib/options.nix')
-rw-r--r--pkgs/lib/options.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix
index 6aad285b7ac..06d4fad8a32 100644
--- a/pkgs/lib/options.nix
+++ b/pkgs/lib/options.nix
@@ -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 {});