···190190 type = types.nullOr types.bool;
191191 default = null;
192192 description = lib.mdDoc ''
193193- Whether this interface should be configured with dhcp.
194194- Null implies the old behavior which depends on whether ip addresses
195195- are specified or not.
193193+ Whether this interface should be configured with DHCP. Overrides the
194194+ default set by {option}`networking.useDHCP`. If `null` (the default),
195195+ DHCP is enabled if the interface has no IPv4 addresses configured
196196+ with {option}`networking.interfaces.<name>.ipv4.addresses`, and
197197+ disabled otherwise.
196198 '';
197199 };
198200···640642 } ];
641643 };
642644 description = lib.mdDoc ''
643643- The configuration for each network interface. If
644644- {option}`networking.useDHCP` is true, then every
645645- interface not listed here will be configured using DHCP.
645645+ The configuration for each network interface.
646646647647 Please note that {option}`systemd.network.netdevs` has more features
648648 and is better maintained. When building new things, it is advised to
···13041304 default = true;
13051305 description = lib.mdDoc ''
13061306 Whether to use DHCP to obtain an IP address and other
13071307- configuration for all network interfaces that are not manually
13081308- configured.
13071307+ configuration for all network interfaces that do not have any manually
13081308+ configured IPv4 addresses.
13091309 '';
13101310 };
13111311
+5-1
nixos/tests/networking.nix
···185185 nodes.router = router;
186186 nodes.client = { lib, ... }: {
187187 # Disable test driver default config
188188- networking.interfaces = lib.mkForce {};
188188+ networking.interfaces = lib.mkForce {
189189+ # Make sure DHCP defaults correctly even when some unrelated config
190190+ # is set on the interface (nothing, in this case).
191191+ enp1s0 = {};
192192+ };
189193 networking.useNetworkd = networkd;
190194 virtualisation.interfaces.enp1s0.vlan = 1;
191195 };