Add extra module argument to provide a nesting.clone option. This option

does the same as nesting.children except that each configuration inherits
from the top-level configuration.

svn path=/nixos/trunk/; revision=21663
This commit is contained in:
Nicolas Pierron 2010-05-08 17:18:26 +00:00
parent 1ba1b66efd
commit 06bfb319fe
3 changed files with 34 additions and 11 deletions

View file

@ -30,7 +30,7 @@ rec {
# These are the extra arguments passed to every module. In
# particular, Nixpkgs is passed through the "pkgs" argument.
extraArgs = extraArgs_ // {
inherit pkgs;
inherit pkgs modules baseModules;
modulesPath = ../modules;
servicesPath = services;
};

View file

@ -0,0 +1,13 @@
# This configuration is not made to figure inside the module-list.nix to
# allow clone of the first level.
{pkgs, ...}:
with pkgs.lib;
{
boot.loader.grub.device = mkOverride 0 {} "";
# undefined the obsolete name of the previous option.
boot.grubDevice = mkOverride 0 {} pkgs.lib.mkNotdef;
nesting.children = mkOverride 0 {} [];
nesting.clone = mkOverride 0 {} [];
}

View file

@ -1,4 +1,4 @@
{pkgs, config, ...}:
{pkgs, config, modules, baseModules, ...}:
let
@ -18,6 +18,14 @@ let
'';
};
nesting.clone = pkgs.lib.mkOption {
default = [];
description = ''
Additional configurations to build based on the current
configuration which is has a lower priority.
'';
};
system.boot.loader.id = pkgs.lib.mkOption {
default = "";
description = ''
@ -71,18 +79,20 @@ let
# you can provide an easy way to boot the same configuration
# as you use, but with another kernel
# !!! fix this
children = with pkgs.lib;
cloner = inheritParent: list: with pkgs.lib;
map (childConfig:
(import ../../../lib/eval-config.nix {
modules = [
(recursiveUpdate childConfig {
boot.loader.grub.device = "";
# undefined the obsolete name of the previous option.
boot.grubDevice = pkgs.lib.mkNotdef;
})
] ++ attrByPath ["require"] [] childConfig;
inherit baseModules;
modules =
(optionals inheritParent modules)
++ [ ./no-clone.nix ]
++ [ childConfig ];
}).config.system.build.toplevel
) config.nesting.children;
) list;
children =
cloner false config.nesting.children
++ cloner true config.nesting.clone;
systemBuilder =