[Nix-dev] Re: [Nix-commits] SVN commit: nix - 19240 - eelco - nixpkgs/trunk/pkgs/lib
Nicolas Pierron
nicolas.b.pierron at gmail.com
Tue Jan 5 20:12:55 CET 2010
On Tue, Jan 5, 2010 at 18:04, Eelco Dolstra <e.dolstra at tudelft.nl> wrote:
> Log:
> * Support require/imports in top-level anonymous configurations,
> i.e. the elements of initModules that are not paths.
You mean support implicitly? But I don't understand how
lazyGenericClosure may handle multiple modules with unnamed sets,
because both sets will have the same key.
> * Support a "key" attribute in anonymous configurations to allow
> lazyGenericClosure to distinguish between them.
That's great, so we can named machine configurations inside NixOS tests.
machine1 = {
require = [ .. ];
key = "machine1 in test42.nix";
services.xserver.enable = true;
};
machine2 = {
imports = [ .. ];
key = "machine2 in test42.nix";
options = { .. };
config = { .. };
};
> Changes:
>
> Modified: nixpkgs/trunk/pkgs/lib/modules.nix
> ===================================================================
> --- nixpkgs/trunk/pkgs/lib/modules.nix 2010-01-05 15:32:14 UTC (rev 19239)
> +++ nixpkgs/trunk/pkgs/lib/modules.nix 2010-01-05 17:04:55 UTC (rev 19240)
> @@ -51,7 +51,7 @@
> getImportedSets = m: filter (x: !isPath x) (getImports m);
>
> getConfig = m:
> - removeAttrs (delayProperties m) ["require"];
> + removeAttrs (delayProperties m) ["require" "key"];
> in
> if isModule m then
> { key = "<unknown location>"; } // m
> @@ -81,18 +81,19 @@
> moduleClosure = initModules: args:
> let
> moduleImport = m:
> - (unifyModuleSyntax (applyIfFunction (importIfPath m) args)) // {
> + let m' = applyIfFunction (importIfPath m) args;
> + in (unifyModuleSyntax m') // {
> # 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;
>
> in
> (lazyGenericClosure {
> - startSet = map moduleImport (filter isPath initModules);
> + startSet = map moduleImport initModules;
> operator = m: map moduleImport (getImports m);
> - }) ++ (map moduleImport (filter (m: ! isPath m) initModules));
> + });
>
> selectDeclsAndDefs = modules:
> lib.concatMap (m:
>
> _______________________________________________
> nix-commits mailing list
> nix-commits at cs.uu.nl
> http://mail.cs.uu.nl/mailman/listinfo/nix-commits
>
--
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
Albert Einstein - Never memorize what you can look up on books.
More information about the nix-dev
mailing list