diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml
index 1b40a84be554..54136ad55cdd 100644
--- a/nixos/doc/manual/release-notes/rl-2009.xml
+++ b/nixos/doc/manual/release-notes/rl-2009.xml
@@ -300,6 +300,17 @@ environment.systemPackages = [
5 for details.
+
+
+ The systemd-networkd option
+ systemd.network.networks._name_.dhcpConfig
+ has been renamed to
+
+ following upstream systemd's documentation change.
+ See systemd.network
+ 5 for details.
+
+
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index c4790f59dff6..887d1de95ff3 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -275,13 +275,13 @@ let
])
];
- checkDhcp = checkUnitConfig "DHCP" [
+ checkDhcpV4 = checkUnitConfig "DHCPv4" [
(assertOnlyFields [
"UseDNS" "RoutesToDNS" "UseNTP" "UseMTU" "Anonymize" "SendHostname" "UseHostname"
"Hostname" "UseDomains" "UseRoutes" "UseTimezone"
"ClientIdentifier" "VendorClassIdentifier" "UserClass" "MaxAttempts"
"DUIDType" "DUIDRawData" "IAID" "RequestBroadcast" "RouteMetric" "RouteTable"
- "ListenPort" "SendRelease" "RapidCommit"
+ "ListenPort" "SendRelease"
])
(assertValueOneOf "UseDNS" boolValues)
(assertValueOneOf "RoutesToDNS" boolValues)
@@ -298,7 +298,6 @@ let
(assertInt "RouteTable")
(assertMinimum "RouteTable" 0)
(assertValueOneOf "SendRelease" boolValues)
- (assertValueOneOf "RapidCommit" boolValues)
];
checkDhcpV6 = checkUnitConfig "DHCPv6" [
@@ -649,13 +648,20 @@ let
'';
};
+ # systemd.network.networks.*.dhcpConfig has been deprecated in favor of ….dhcpV4Config
+ # Produce a nice warning message so users know it is gone.
dhcpConfig = mkOption {
+ visible = false;
+ apply = _: throw "The option `systemd.network.networks.*.dhcpConfig` can no longer be used since it's been removed. Please use `systemd.network.networks.*.dhcpV4Config` instead.";
+ };
+
+ dhcpV4Config = mkOption {
default = {};
example = { UseDNS = true; UseRoutes = true; };
- type = types.addCheck (types.attrsOf unitOption) checkDhcp;
+ type = types.addCheck (types.attrsOf unitOption) checkDhcpV4;
description = ''
Each attribute in this set specifies an option in the
- [DHCP] section of the unit. See
+ [DHCPv4] section of the unit. See
systemd.network
5 for details.
'';
@@ -998,9 +1004,9 @@ let
${concatStringsSep "\n" (map (s: "Tunnel=${s}") def.tunnel)}
${concatStringsSep "\n" (map (s: "Xfrm=${s}") def.xfrm)}
- ${optionalString (def.dhcpConfig != { }) ''
- [DHCP]
- ${attrsToSection def.dhcpConfig}
+ ${optionalString (def.dhcpV4Config != { }) ''
+ [DHCPv4]
+ ${attrsToSection def.dhcpV4Config}
''}
${optionalString (def.dhcpV6Config != {}) ''
@@ -1084,6 +1090,7 @@ in
};
config = mkMerge [
+
# .link units are honored by udev, no matter if systemd-networkd is enabled or not.
{
systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.link" (linkToUnit n v)) cfg.links;
diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix
index 016d68ea3018..b0fa03917c82 100644
--- a/nixos/modules/virtualisation/nixos-containers.nix
+++ b/nixos/modules/virtualisation/nixos-containers.nix
@@ -546,7 +546,7 @@ in
Note that this option might require to do some adjustments to the container configuration,
e.g. you might want to set
- systemd.network.networks.$interface.dhcpConfig.ClientIdentifier to "mac"
+ systemd.network.networks.$interface.dhcpV4Config.ClientIdentifier to "mac"
if you use macvlans option.
This way dhcp client identifier will be stable between the container restarts.