mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
nixos/containers: fix default gateway with privateNetwork (v2) (#524281)
This commit is contained in:
@@ -607,14 +607,16 @@ in
|
||||
boot.isNspawnContainer = true;
|
||||
networking.hostName = mkDefault name;
|
||||
networking.useDHCP = false;
|
||||
networking.interfaces = lib.mkIf config.privateNetwork {
|
||||
eth0.ipv4.addresses = lib.optional (config.localAddress != null) (
|
||||
ipv4FromString config.localAddress
|
||||
);
|
||||
eth0.ipv6.addresses = lib.optional (config.localAddress6 != null) (
|
||||
lib.network.ipv6.fromString config.localAddress6
|
||||
);
|
||||
};
|
||||
networking.interfaces = lib.mkIf config.privateNetwork (
|
||||
lib.mkMerge [
|
||||
(lib.mkIf (config.localAddress != null) {
|
||||
eth0.ipv4.addresses = [ (ipv4FromString config.localAddress) ];
|
||||
})
|
||||
(lib.mkIf (config.localAddress6 != null) {
|
||||
eth0.ipv6.addresses = [ (lib.network.ipv6.fromString config.localAddress6) ];
|
||||
})
|
||||
]
|
||||
);
|
||||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
|
||||
Reference in New Issue
Block a user