From 6d64b1d92c9ac0b0f7404f8bbb3a302b3030027a Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 7 Jun 2013 03:42:46 -0400 Subject: Give unique keys to submodule components I'm not wed to the outPath values I chose, other options are probably valid there too. It would be nice if we could track which file each merged value came from as well. Signed-off-by: Shea Levy --- pkgs/lib/modules.nix | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'pkgs/lib/modules.nix') diff --git a/pkgs/lib/modules.nix b/pkgs/lib/modules.nix index 74603e9c579..3d4ebc32512 100644 --- a/pkgs/lib/modules.nix +++ b/pkgs/lib/modules.nix @@ -75,12 +75,19 @@ rec { ); - unifyOptionModule = {key ? ""}: m: (args: - let module = lib.applyIfFunction m args; in - if lib.isModule module then - { inherit key; } // module + unifyOptionModule = {key ? ""}: name: index: m: (args: + let + module = lib.applyIfFunction m args; + key_ = rec { + file = key; + option = name; + number = index; + outPath = "file ${toString file} option ${option} options number ${toString number}"; + }; + in if lib.isModule module then + { key = key_; } // module else - { inherit key; options = module; } + { key = key_; options = module; } ); @@ -240,7 +247,7 @@ rec { decls = # add location to sub-module options. map (m: mapSubOptions - (unifyOptionModule {inherit (m) key;}) + (unifyOptionModule {inherit (m) key;} name) m.options ) declarations; -- cgit 1.4.1