summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorPhilip Taron <philip.taron@gmail.com>2023-10-16 15:04:44 -0700
committerPhilip Taron <philip.taron@gmail.com>2023-10-16 15:04:44 -0700
commit989cca26c4166d0e1793cb78cf8b9b25472c6f02 (patch)
tree7f7209345c8b7af52e14ca9c0f4b74b5da431b75 /nixos/modules/system
parentde635523b04b7e3087a85b3de59a71244e52ebb2 (diff)
downloadnixpkgs-989cca26c4166d0e1793cb78cf8b9b25472c6f02.tar
nixpkgs-989cca26c4166d0e1793cb78cf8b9b25472c6f02.tar.gz
nixpkgs-989cca26c4166d0e1793cb78cf8b9b25472c6f02.tar.bz2
nixpkgs-989cca26c4166d0e1793cb78cf8b9b25472c6f02.tar.lz
nixpkgs-989cca26c4166d0e1793cb78cf8b9b25472c6f02.tar.xz
nixpkgs-989cca26c4166d0e1793cb78cf8b9b25472c6f02.tar.zst
nixpkgs-989cca26c4166d0e1793cb78cf8b9b25472c6f02.zip
systemd.network.netdev: Add support for WLAN devices
These are virtual interface, where one physical wifi adapter can have
more than one interface.

See https://systemd.network/systemd.netdev.html#%5BWLAN%5D%20Section%20Options
and https://github.com/systemd/systemd/commit/dedf2d0054eb3150697b1540bf9733cba9e881fd
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/networkd.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index a5084260daa..717f7ab2363 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -159,6 +159,7 @@ let
           "geneve"
           "l2tp"
           "macsec"
+          "wlan"
           "vrf"
           "vcan"
           "vxcan"
@@ -468,6 +469,19 @@ let
         (assertMinimum "Table" 0)
       ];
 
+      sectionWLAN = checkUnitConfig "WLAN" [
+        (assertOnlyFields [
+          "PhysicalDevice"
+          "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"])
+        (assertValueOneOf "WDS" boolValues)
+      ];
+
       sectionBatmanAdvanced = checkUnitConfig "BatmanAdvanced" [
         (assertOnlyFields [
           "GatewayMode"
@@ -1779,6 +1793,16 @@ let
       '';
     };
 
+    wlanConfig = mkOption {
+      default = {};
+      example = { PhysicalDevice = 0; Type = "station"; };
+      type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionWLAN;
+      description = lib.mdDoc ''
+        Each attribute in this set specifies an option in the `[WLAN]` section of the unit.
+        See {manpage}`systemd.netdev(5)` for details.
+      '';
+    };
+
     batmanAdvancedConfig = mkOption {
       default = {};
       example = {