Skip to content

Commit

Permalink
nixos/lxc/container: fix useDhcp with veth
Browse files Browse the repository at this point in the history
#347283 changed the default to
exclude non-physical network Kind, but that unfortunately also includes
`veth` which LXC uses for its network interfaces. Re-enable that
functionality so users can use networkd with useDHCP.
  • Loading branch information
adamcstephens committed Nov 29, 2024
1 parent 964bdaa commit f50a1bd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nixos/modules/virtualisation/lxc-container.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@
${config.nix.package.out}/bin/nix-env -p /nix/var/nix/profiles/system --set /run/current-system
'';

# supplement 99-ethernet-default-dhcp which excludes veth
systemd.network = lib.mkIf config.networking.useDHCP {
networks."99-lxc-veth-default-dhcp" = {
matchConfig = {
Type = "ether";
Kind = "veth";
Name = [
"en*"
"eth*"
];
};
DHCP = "yes";
networkConfig.IPv6PrivacyExtensions = "kernel";
};
};

system.build.tarball = pkgs.callPackage ../../lib/make-system-tarball.nix {
extraArgs = "--owner=0";

Expand Down

0 comments on commit f50a1bd

Please sign in to comment.