Author: NicolasPierron
Date: Wed Apr 27 18:41:37 2011
New Revision: 27014
URL: https://svn.nixos.org/websvn/nix/?rev=27014&sc=1
Log:
modules (moduleClosure): use imap instead of map to produce uniq keys for
the genericClosure.
Modified:
nixpkgs/trunk/pkgs/lib/modules.nix
Modified: nixpkgs/trunk/pkgs/lib/modules.nix
==============================================================================
--- nixpkgs/trunk/pkgs/lib/modules.nix Wed Apr 27 18:41:34 2011 (r27013)
+++ nixpkgs/trunk/pkgs/lib/modules.nix Wed Apr 27 18:41:37 2011 (r27014)
@@ -80,19 +80,29 @@
moduleClosure = initModules: args:
let
- moduleImport = m:
+ moduleImport = origin: index: m:
let m' = applyIfFunction (importIfPath m) args;
in (unifyModuleSyntax m') // {
# used by generic closure to avoid duplicated imports.
- key = if isPath m then m else if m' ? key then m'.key else "<unknown
location>";
+ key =
+ if isPath m then m
+ else if m' ? key then m'.key
+ else newModuleName origin index;
};
getImports = m: attrByPath ["imports"] [] m;
+ newModuleName = origin: index:
+ "${origin.key}:<import-${toString index}>";
+
+ topLevel = {
+ key = "<top-level>";
+ };
+
in
(lazyGenericClosure {
- startSet = map moduleImport initModules;
- operator = m: map moduleImport (getImports m);
+ startSet = imap (moduleImport topLevel) initModules;
+ operator = m: imap (moduleImport m) (getImports m);
});
selectDeclsAndDefs = modules:
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits