diff --git a/nixos/lib/systemd-lib.nix b/nixos/lib/systemd-lib.nix index eb2bcb9d3b98..61ac04eff288 100644 --- a/nixos/lib/systemd-lib.nix +++ b/nixos/lib/systemd-lib.nix @@ -63,7 +63,12 @@ in rec { assertMacAddress = name: group: attr: optional (attr ? ${name} && ! isMacAddress attr.${name}) - "Systemd ${group} field `${name}' must be a valid mac address."; + "Systemd ${group} field `${name}' must be a valid MAC address."; + + assertNetdevMacAddress = name: group: attr: + optional (attr ? ${name} && (! isMacAddress attr.${name} || attr.${name} != "none")) + "Systemd ${group} field `${name}` must be a valid MAC address or the special value `none`."; + isPort = i: i >= 0 && i <= 65535; diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index a7183daf5e0a..9cc3541c9dcf 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -170,7 +170,7 @@ let "batadv" ]) (assertByteFormat "MTUBytes") - (assertMacAddress "MACAddress") + (assertNetdevMacAddress "MACAddress") ]; sectionVLAN = checkUnitConfig "VLAN" [