summary refs log tree commit diff
path: root/pkgs/lib/options.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/lib/options.nix')
-rw-r--r--pkgs/lib/options.nix16
1 files changed, 9 insertions, 7 deletions
diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix
index 3a8cc0006ef..1fdf9ad8088 100644
--- a/pkgs/lib/options.nix
+++ b/pkgs/lib/options.nix
@@ -31,7 +31,7 @@ rec {
   mapSubOptions = f: opt:
     if opt ? options then
       opt // {
-        options = map f (toList opt.options);
+        options = imap f (toList opt.options);
       }
     else
       opt;
@@ -82,16 +82,18 @@ rec {
       handleOptionSets = opt:
         if opt ? type && opt.type.hasOptions then
           let
-            
-            optionConfig = vals: args:
-              map (f: lib.applyIfFunction f args)
-                (opt.options ++ toList vals);
-
             # Evaluate sub-modules.
             subModuleMerge = path: vals:
               lib.fix (args:
                 let
-                  result = recurseInto path (optionConfig vals args);
+                  result = recurseInto path (opt.options ++ imap (index: v: args: {
+                    key = rec {
+                      #!!! Would be nice if we had the file the val was from
+                      option = path;
+                      number = index;
+                      outPath = "option ${option} config number ${toString number}";
+                    };
+                  } // (lib.applyIfFunction v args)) (toList vals)) args;
                   name = lib.removePrefix (opt.name + ".") path;
                   extraArgs = opt.extraArgs or {};
                   individualExtraArgs = opt.individualExtraArgs or {};