I used to use the following on NixOS -unstable until today's upgrade
(admittedly, after quite a while):
networking = {
useDHCP = true;
useNetworkd = true;
}
My goal was to use systemd-networkd(8) and a generic way of enabling
DHCP for all interfaces.
As of today, useDHCP is deprecated and above config will result in an
assertion failure that recommends using disabling the global and
enabling explicit per-interface configuration for DHCP.
Thus the following amended config works
networking = {
useDHCP = false;
interfaces.enp0s2.useDHCP = true;
useNetworkd = true;
}
but is not interface agnostic any longer. Using the first version,
would it be possible to make /etc/systemd/network/99-main.network
default to DHCP on (all) interfaces, unless explicit/more specific
interface configuration is provided?