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:05 +0000
committerNicolas Pierron <nicolas.b.pierron@gmail.com>2009-09-18 15:10:05 +0000
commite07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241 (patch)
tree620e92c4def481fcab084b6f802410877d3acd6d /pkgs/lib/options.nix
parenta727aa8d8b143a6930d4f4da7fe1ccb2fd3b6b01 (diff)
downloadnixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar
nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.gz
nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.bz2
nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.lz
nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.xz
nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.tar.zst
nixpkgs-e07f5d2a2cb72d8ba7fbfd4bf7999d6bf3684241.zip
Add location to declared sub-modules.
svn path=/nixpkgs/trunk/; revision=17252
Diffstat (limited to 'pkgs/lib/options.nix')
-rw-r--r--pkgs/lib/options.nix23
1 files changed, 8 insertions, 15 deletions
diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix
index 37d092ef3c5..6aad285b7ac 100644
--- a/pkgs/lib/options.nix
+++ b/pkgs/lib/options.nix
@@ -27,6 +27,14 @@ rec {
     # options (set of sub-options declarations & definitions)
   };
 
+  mapSubOptions = f: opt:
+    if opt ? options then
+      opt // {
+        options = map f (toList opt.options);
+      }
+    else
+      opt;
+
   # Make the option declaration more user-friendly by adding default
   # settings and some verifications based on the declaration content (like
   # type correctness).
@@ -68,20 +76,6 @@ rec {
           }
         else opt;
 
-      convertOptionsToModules = opt:
-        if opt ? options then
-          opt // {
-            options = map (decl:
-              let module = lib.applyIfFunction decl {}; in
-              if lib.isModule module then
-                decl
-              else
-                arg: { options = lib.applyIfFunction decl arg; }
-            ) opt.options;
-          }
-        else
-          opt;
-
       handleOptionSets = opt:
         if decl ? type && decl.type.hasOptions then
           let
@@ -119,7 +113,6 @@ rec {
         # override settings
         ensureMergeInputType
         ensureDefaultType
-        convertOptionsToModules
         handleOptionSets
       ];