summary refs log tree commit diff
path: root/nixos/modules/services/networking/hostapd.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2019-04-12 17:17:19 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2019-04-12 19:27:19 +0200
commitf975bbae114682523197385e820b4f51dcd04cf6 (patch)
tree9fb195e2da3e3153c77035976307c12e78e139ed /nixos/modules/services/networking/hostapd.nix
parent6b2bd330fa39376fe5143d8095b9a1b925255110 (diff)
downloadnixpkgs-f975bbae114682523197385e820b4f51dcd04cf6.tar
nixpkgs-f975bbae114682523197385e820b4f51dcd04cf6.tar.gz
nixpkgs-f975bbae114682523197385e820b4f51dcd04cf6.tar.bz2
nixpkgs-f975bbae114682523197385e820b4f51dcd04cf6.tar.lz
nixpkgs-f975bbae114682523197385e820b4f51dcd04cf6.tar.xz
nixpkgs-f975bbae114682523197385e820b4f51dcd04cf6.tar.zst
nixpkgs-f975bbae114682523197385e820b4f51dcd04cf6.zip
nixos/hostapd: escape interface names for hostapd
Same problem as described in acbadcdbba3e768a936c88e45a843bd72ecf247c.

When using multiple interfaces for wifi with `networking.wlanInterfaces`
and the interface for `hostapd` contains a dash, this will fail as
systemd escapes dashes in its device names.
Diffstat (limited to 'nixos/modules/services/networking/hostapd.nix')
-rw-r--r--nixos/modules/services/networking/hostapd.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/hostapd.nix b/nixos/modules/services/networking/hostapd.nix
index 3fbc08e9060..7add48308f8 100644
--- a/nixos/modules/services/networking/hostapd.nix
+++ b/nixos/modules/services/networking/hostapd.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, utils, ... }:
 
 # TODO:
 #
@@ -12,6 +12,8 @@ let
 
   cfg = config.services.hostapd;
 
+  escapedInterface = utils.escapeSystemdPath cfg.interface;
+
   configFile = pkgs.writeText "hostapd.conf" ''
     interface=${cfg.interface}
     driver=${cfg.driver}
@@ -157,8 +159,8 @@ in
       { description = "hostapd wireless AP";
 
         path = [ pkgs.hostapd ];
-        after = [ "sys-subsystem-net-devices-${cfg.interface}.device" ];
-        bindsTo = [ "sys-subsystem-net-devices-${cfg.interface}.device" ];
+        after = [ "sys-subsystem-net-devices-${escapedInterface}.device" ];
+        bindsTo = [ "sys-subsystem-net-devices-${escapedInterface}.device" ];
         requiredBy = [ "network-link-${cfg.interface}.service" ];
 
         serviceConfig =