nixos/containers: Process config like toplevel options (#17365)

This commit is contained in:
Guillaume Maudoux 2016-08-29 18:25:50 +02:00 committed by Franz Pletz
parent 6ae57b1b63
commit 3aef93e8f0

View File

@ -340,6 +340,20 @@ in
A specification of the desired configuration of this A specification of the desired configuration of this
container, as a NixOS module. container, as a NixOS module.
''; '';
type = lib.mkOptionType {
name = "Toplevel NixOS config";
merge = loc: defs: (import ../../lib/eval-config.nix {
inherit system;
modules =
let extraConfig =
{ boot.isContainer = true;
networking.hostName = mkDefault name;
networking.useDHCP = false;
};
in [ extraConfig ] ++ (map (x: x.value) defs);
prefix = [ "containers" name ];
}).config;
};
}; };
path = mkOption { path = mkOption {
@ -410,18 +424,9 @@ in
} // networkOptions; } // networkOptions;
config = mkMerge config = mkMerge
[ (mkIf options.config.isDefined { [
path = (import ../../lib/eval-config.nix { (mkIf options.config.isDefined {
inherit system; path = config.config.system.build.toplevel;
modules =
let extraConfig =
{ boot.isContainer = true;
networking.hostName = mkDefault name;
networking.useDHCP = false;
};
in [ extraConfig config.config ];
prefix = [ "containers" name ];
}).config.system.build.toplevel;
}) })
]; ];
})); }));