containers: deny networkmanager from managing the ve-* and vb-* NICs

Without this, when you've enabled networkmanager and start a
nixos-container the container will briefly have its specified IP
address but then networkmanager starts managing it causing the IP
address to be dropped.
This commit is contained in:
Bas van Dijk 2017-11-21 08:41:41 +01:00 committed by Robert Helgesson
parent 875eaf0821
commit 5572de75a0
No known key found for this signature in database
GPG Key ID: C3DB11069E65DC86

View File

@ -726,6 +726,11 @@ in
networking.dhcpcd.denyInterfaces = [ "ve-*" "vb-*" ];
services.udev.extraRules = optionalString config.networking.networkmanager.enable ''
# Don't manage interfaces created by nixos-container.
ENV{INTERFACE}=="v[e,b]-*", ENV{NM_UNMANAGED}="1"
'';
environment.systemPackages = [ pkgs.nixos-container ];
});
}