diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2009-07-16 21:08:32 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2009-07-16 21:08:32 +0000 |
commit | d59155960977939fc748e2930685e635255c9ee9 (patch) | |
tree | e802c94b1693b593dac5c01fa9d1493c99ed56f9 /modules/services/networking/wpa_supplicant.nix | |
parent | 3abf509637ff3693615aed97a0f0bb0aa80e919a (diff) | |
download | nixpkgs-d59155960977939fc748e2930685e635255c9ee9.tar nixpkgs-d59155960977939fc748e2930685e635255c9ee9.tar.gz nixpkgs-d59155960977939fc748e2930685e635255c9ee9.tar.bz2 nixpkgs-d59155960977939fc748e2930685e635255c9ee9.tar.lz nixpkgs-d59155960977939fc748e2930685e635255c9ee9.tar.xz nixpkgs-d59155960977939fc748e2930685e635255c9ee9.tar.zst nixpkgs-d59155960977939fc748e2930685e635255c9ee9.zip |
* A simple module for running wpa_supplicant.
svn path=/nixos/branches/modular-nixos/; revision=16409
Diffstat (limited to 'modules/services/networking/wpa_supplicant.nix')
-rw-r--r-- | modules/services/networking/wpa_supplicant.nix | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/modules/services/networking/wpa_supplicant.nix b/modules/services/networking/wpa_supplicant.nix new file mode 100644 index 00000000000..7cb75fd68a2 --- /dev/null +++ b/modules/services/networking/wpa_supplicant.nix @@ -0,0 +1,54 @@ +{pkgs, config, ...}: + +let + + configFile = "/etc/wpa_supplicant.conf"; + +in + +{ + + ###### interface + + options = { + + networking.enableWLAN = pkgs.lib.mkOption { + default = false; + description = '' + Whether to start <command>wpa_supplicant</command> to scan for + and associate with wireless networks. Note: NixOS currently + does not generate <command>wpa_supplicant</command>'s + configuration file, <filename>${configFile}</filename>. You + should edit this file yourself to define wireless networks, + WPA keys and so on (see + <citerefentry><refentrytitle>wpa_supplicant.conf</refentrytitle> + <manvolnum>5</manvolnum></citerefentry>). + ''; + }; + + }; + + + ###### implementation + + config = pkgs.lib.mkIf config.networking.enableWLAN { + + environment.systemPackages = [pkgs.wpa_supplicant]; + + jobs = pkgs.lib.singleton + { name = "wpa_supplicant"; + + preStart = + '' + touch -a ${configFile} + chmod 600 ${configFile} + ''; + + exec = + "${pkgs.wpa_supplicant}/sbin/wpa_supplicant " + + "-C /var/run/wpa_supplicant -c ${configFile} -iwlan0"; + }; + + }; + +} |