From 173a3a25f03045d97290e796d87dde5e2259903d Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Tue, 17 Oct 2023 09:43:37 -0700 Subject: [PATCH] Remove restriction on PhysicalDevice being int; reformat and document the Type field --- nixos/modules/system/boot/networkd.nix | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 717f7ab23635..cbb521f0b037 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -471,14 +471,25 @@ let sectionWLAN = checkUnitConfig "WLAN" [ (assertOnlyFields [ - "PhysicalDevice" + "PhysicalDevice" # systemd supports both strings ("phy0") and indexes (0) here. "Type" "WDS" ]) - # systemd supports strings here too ("phy0") but index is good enough - (assertInt "PhysicalDevice") - (assertMinimum "PhysicalDevice" 0) - (assertValueOneOf "Type" ["ad-hoc" "station" "ap" "ap-vlan" "wds" "monitor" "mesh-point" "p2p-client" "p2p-go" "p2p-device" "ocb" "nan"]) + # See https://github.com/systemd/systemd/blob/main/src/basic/linux/nl80211.h#L3382 + (assertValueOneOf "Type" [ + "ad-hoc" + "station" + "ap" + "ap-vlan" + "wds" + "monitor" + "mesh-point" + "p2p-client" + "p2p-go" + "p2p-device" + "ocb" + "nan" + ]) (assertValueOneOf "WDS" boolValues) ];