summaryrefslogtreecommitdiffstats
path: root/nixos/modules/virtualisation/containers.nix
diff options
context:
space:
mode:
authorGuillaume Maudoux <layus.on@gmail.com>2016-08-29 18:25:50 +0200
committerFranz Pletz <fpletz@fnordicwalking.de>2016-08-29 18:25:50 +0200
commit3aef93e8f046210f1715b555d835f2f20cd07753 (patch)
tree92fbf4bc91da6b6f2fd44dc51a141675be0d52a2 /nixos/modules/virtualisation/containers.nix
parent6ae57b1b634d2145f72c1742685695e7192102ba (diff)
nixos/containers: Process config like toplevel options (#17365)
Diffstat (limited to 'nixos/modules/virtualisation/containers.nix')
-rw-r--r--nixos/modules/virtualisation/containers.nix29
1 files changed, 17 insertions, 12 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index d83841452f95..413aa94339f1 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -340,6 +340,20 @@ in
A specification of the desired configuration of this
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 {
@@ -410,18 +424,9 @@ in
} // networkOptions;
config = mkMerge
- [ (mkIf options.config.isDefined {
- path = (import ../../lib/eval-config.nix {
- inherit system;
- modules =
- let extraConfig =
- { boot.isContainer = true;
- networking.hostName = mkDefault name;
- networking.useDHCP = false;
- };
- in [ extraConfig config.config ];
- prefix = [ "containers" name ];
- }).config.system.build.toplevel;
+ [
+ (mkIf options.config.isDefined {
+ path = config.config.system.build.toplevel;
})
];
}));