nixos/hostapd: escape interface names for hostapd

Same problem as described in acbadcdbba.

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.
This commit is contained in:
Maximilian Bosch 2019-04-12 17:17:19 +02:00
parent 6b2bd330fa
commit f975bbae11
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E

View file

@ -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 =