diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2020-01-08 20:18:26 +0100 |
---|---|---|
committer | Andreas Rammhold <andreas@rammhold.de> | 2020-05-01 13:33:54 +0200 |
commit | 819e8bb35f4a8371ee6af77dba9b8860041956b6 (patch) | |
tree | b2f03dda5a0b71391e6dd1e68019db71241044b7 /nixos | |
parent | bb9b61e2b7d1dd14d9685bb188d13f45cdf21ad5 (diff) | |
download | nixpkgs-819e8bb35f4a8371ee6af77dba9b8860041956b6.tar nixpkgs-819e8bb35f4a8371ee6af77dba9b8860041956b6.tar.gz nixpkgs-819e8bb35f4a8371ee6af77dba9b8860041956b6.tar.bz2 nixpkgs-819e8bb35f4a8371ee6af77dba9b8860041956b6.tar.lz nixpkgs-819e8bb35f4a8371ee6af77dba9b8860041956b6.tar.xz nixpkgs-819e8bb35f4a8371ee6af77dba9b8860041956b6.tar.zst nixpkgs-819e8bb35f4a8371ee6af77dba9b8860041956b6.zip |
nixos/networkd: rename the networkd dhcpConfig option to dhcpV4Config
This follows upstreams change in documentation. While the `[DHCP]` section might still work it is undocumented and we should probably not be using it anymore. Users can just upgrade to the new option without much hassle. I had to create a bit of custom module deprecation code since the usual approach doesn't support wildcards in the path.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2009.xml | 11 | ||||
-rw-r--r-- | nixos/modules/system/boot/networkd.nix | 23 | ||||
-rw-r--r-- | nixos/modules/virtualisation/nixos-containers.nix | 2 |
3 files changed, 27 insertions, 9 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2009.xml b/nixos/doc/manual/release-notes/rl-2009.xml index 1b40a84be55..54136ad55cd 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 = [ <manvolnum>5</manvolnum></citerefentry> for details. </para> </listitem> + <listitem> + <para> + The <literal>systemd-networkd</literal> option + <literal>systemd.network.networks._name_.dhcpConfig</literal> + has been renamed to + <xref linkend="opt-systemd.network.networks._name_.dhcpV4Config"/> + following upstream systemd's documentation change. + See <citerefentry><refentrytitle>systemd.network</refentrytitle> + <manvolnum>5</manvolnum></citerefentry> for details. + </para> + </listitem> </itemizedlist> </section> diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index c4790f59dff..887d1de95ff 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 - <literal>[DHCP]</literal> section of the unit. See + <literal>[DHCPv4]</literal> section of the unit. See <citerefentry><refentrytitle>systemd.network</refentrytitle> <manvolnum>5</manvolnum></citerefentry> 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 016d68ea301..b0fa03917c8 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 - <varname>systemd.network.networks.$interface.dhcpConfig.ClientIdentifier</varname> to "mac" + <varname>systemd.network.networks.$interface.dhcpV4Config.ClientIdentifier</varname> to "mac" if you use <varname>macvlans</varname> option. This way dhcp client identifier will be stable between the container restarts. |