about summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-28 20:10:49 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-28 20:12:06 +0200
commitcbfba813fe22b80e82bfa6fd5c10db6624130774 (patch)
treecab9980e68aea5d9f610fce39ac4d3cffd1bb584 /nixos/modules/services
parentf5cd4eef1136c617ef66e40191e1333261102bc5 (diff)
downloadnixlib-cbfba813fe22b80e82bfa6fd5c10db6624130774.tar
nixlib-cbfba813fe22b80e82bfa6fd5c10db6624130774.tar.gz
nixlib-cbfba813fe22b80e82bfa6fd5c10db6624130774.tar.bz2
nixlib-cbfba813fe22b80e82bfa6fd5c10db6624130774.tar.lz
nixlib-cbfba813fe22b80e82bfa6fd5c10db6624130774.tar.xz
nixlib-cbfba813fe22b80e82bfa6fd5c10db6624130774.tar.zst
nixlib-cbfba813fe22b80e82bfa6fd5c10db6624130774.zip
wpa_supplicant: Restart when wlan devices (dis)appear
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/networking/wpa_supplicant.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix
index 987b21da9ec9..771eeecd772b 100644
--- a/nixos/modules/services/networking/wpa_supplicant.nix
+++ b/nixos/modules/services/networking/wpa_supplicant.nix
@@ -90,11 +90,11 @@ in
 
     services.dbus.packages = [ pkgs.wpa_supplicant ];
 
+    # FIXME: start a separate wpa_supplicant instance per interface.
     jobs.wpa_supplicant =
       { description = "WPA Supplicant";
 
         wantedBy = [ "network.target" ];
-        after = [ "systemd-udev-settle.service" ];
 
         path = [ pkgs.wpa_supplicant ];
 
@@ -133,6 +133,12 @@ in
     assertions = [{ assertion = !cfg.userControlled.enable || cfg.interfaces != [];
                     message = "user controlled wpa_supplicant needs explicit networking.wireless.interfaces";}];
 
+    # Restart wpa_supplicant when a wlan device appears or disappears.
+    services.udev.extraRules =
+      ''
+        ACTION=="add|remove", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", RUN+="${config.systemd.package}/bin/systemctl try-restart wpa_supplicant.service"
+      '';
+
   };
 
 }