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 # These are the extra arguments passed to every module. In
# particular, Nixpkgs is passed through the "pkgs" argument. # particular, Nixpkgs is passed through the "pkgs" argument.
extraArgs = extraArgs_ // { extraArgs = extraArgs_ // {
inherit pkgs; inherit pkgs modules baseModules;
modulesPath = ../modules; modulesPath = ../modules;
servicesPath = services; 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 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 { system.boot.loader.id = pkgs.lib.mkOption {
default = ""; default = "";
description = '' description = ''
@ -71,18 +79,20 @@ let
# you can provide an easy way to boot the same configuration # you can provide an easy way to boot the same configuration
# as you use, but with another kernel # as you use, but with another kernel
# !!! fix this # !!! fix this
children = with pkgs.lib; cloner = inheritParent: list: with pkgs.lib;
map (childConfig: map (childConfig:
(import ../../../lib/eval-config.nix { (import ../../../lib/eval-config.nix {
modules = [ inherit baseModules;
(recursiveUpdate childConfig { modules =
boot.loader.grub.device = ""; (optionals inheritParent modules)
# undefined the obsolete name of the previous option. ++ [ ./no-clone.nix ]
boot.grubDevice = pkgs.lib.mkNotdef; ++ [ childConfig ];
})
] ++ attrByPath ["require"] [] childConfig;
}).config.system.build.toplevel }).config.system.build.toplevel
) config.nesting.children; ) list;
children =
cloner false config.nesting.children
++ cloner true config.nesting.clone;
systemBuilder = systemBuilder =