mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-17 01:24:47 +00:00
* Support require/imports in top-level anonymous configurations,
i.e. the elements of initModules that are not paths. * Support a "key" attribute in anonymous configurations to allow lazyGenericClosure to distinguish between them. svn path=/nixpkgs/trunk/; revision=19240
This commit is contained in:
parent
1dfec1c467
commit
21358e7ad0
@ -51,7 +51,7 @@ rec {
|
|||||||
getImportedSets = m: filter (x: !isPath x) (getImports m);
|
getImportedSets = m: filter (x: !isPath x) (getImports m);
|
||||||
|
|
||||||
getConfig = m:
|
getConfig = m:
|
||||||
removeAttrs (delayProperties m) ["require"];
|
removeAttrs (delayProperties m) ["require" "key"];
|
||||||
in
|
in
|
||||||
if isModule m then
|
if isModule m then
|
||||||
{ key = "<unknown location>"; } // m
|
{ key = "<unknown location>"; } // m
|
||||||
@ -81,18 +81,19 @@ rec {
|
|||||||
moduleClosure = initModules: args:
|
moduleClosure = initModules: args:
|
||||||
let
|
let
|
||||||
moduleImport = m:
|
moduleImport = m:
|
||||||
(unifyModuleSyntax (applyIfFunction (importIfPath m) args)) // {
|
let m' = applyIfFunction (importIfPath m) args;
|
||||||
|
in (unifyModuleSyntax m') // {
|
||||||
# used by generic closure to avoid duplicated imports.
|
# used by generic closure to avoid duplicated imports.
|
||||||
key = if isPath m then m else "<unknown location>";
|
key = if isPath m then m else if m' ? key then m'.key else "<unknown location>";
|
||||||
};
|
};
|
||||||
|
|
||||||
getImports = m: attrByPath ["imports"] [] m;
|
getImports = m: attrByPath ["imports"] [] m;
|
||||||
|
|
||||||
in
|
in
|
||||||
(lazyGenericClosure {
|
(lazyGenericClosure {
|
||||||
startSet = map moduleImport (filter isPath initModules);
|
startSet = map moduleImport initModules;
|
||||||
operator = m: map moduleImport (getImports m);
|
operator = m: map moduleImport (getImports m);
|
||||||
}) ++ (map moduleImport (filter (m: ! isPath m) initModules));
|
});
|
||||||
|
|
||||||
selectDeclsAndDefs = modules:
|
selectDeclsAndDefs = modules:
|
||||||
lib.concatMap (m:
|
lib.concatMap (m:
|
||||||
|
Loading…
Reference in New Issue
Block a user