mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-13 07:17:29 +00:00
nixos/containers: Process config like toplevel options (#17365)
This commit is contained in:
parent
6ae57b1b63
commit
3aef93e8f0
@ -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;
|
||||
})
|
||||
];
|
||||
}));
|
||||
|
Loading…
Reference in New Issue
Block a user