git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/containers: Process config like toplevel options (#17365)
commit3aef93e8f046210f1715b555d835f2f20cd07753 authorGuillaume Maudoux <layus.on@gmail.com> dateMon 29 Aug 2016, 18:25 (10 years ago) parent6ae57b1
1 file changed+17−12
nixos/modules/virtualisation/containers.nix+17−12
nixos/modules/virtualisation/containers.nix+17−12
@@ -340,6 +340,20 @@ in
340340 A specification of the desired configuration of this
341341 container, as a NixOS module.
342342 '';
343+ type = lib.mkOptionType {
344+ name = "Toplevel NixOS config";
345+ merge = loc: defs: (import ../../lib/eval-config.nix {
346+ inherit system;
347+ modules =
348+ let extraConfig =
349+ { boot.isContainer = true;
350+ networking.hostName = mkDefault name;
351+ networking.useDHCP = false;
352+ };
353+ in [ extraConfig ] ++ (map (x: x.value) defs);
354+ prefix = [ "containers" name ];
355+ }).config;
356+ };
343357 };
344358
345359 path = mkOption {
@@ -410,18 +424,9 @@ in
410424 } // networkOptions;
411425
412426 config = mkMerge
413− [ (mkIf options.config.isDefined {
414− path = (import ../../lib/eval-config.nix {
415− inherit system;
416− modules =
417− let extraConfig =
418− { boot.isContainer = true;
419− networking.hostName = mkDefault name;
420− networking.useDHCP = false;
421− };
422− in [ extraConfig config.config ];
423− prefix = [ "containers" name ];
424− }).config.system.build.toplevel;
427+ [
428+ (mkIf options.config.isDefined {
429+ path = config.config.system.build.toplevel;
425430 })
426431 ];
427432 }));