use module-based-service for hostapd
This commit is contained in:
parent
17abd42cf3
commit
648ea5613b
3 changed files with 40 additions and 14 deletions
|
@ -1,40 +0,0 @@
|
|||
# This is not a friendly interface to configuring a wireless AP: it
|
||||
# just passes everything straight through to the hostapd config. When
|
||||
# we've worked out what the sensible options are to expose, we'll add
|
||||
# them as top-level attributes and rename params to extraParams
|
||||
|
||||
{
|
||||
liminix
|
||||
, hostapd
|
||||
, lib
|
||||
, writeText
|
||||
}:
|
||||
interface:
|
||||
{
|
||||
params ? {}
|
||||
}:
|
||||
let
|
||||
inherit (liminix.services) longrun;
|
||||
inherit (lib) concatStringsSep mapAttrsToList;
|
||||
inherit (builtins) toString;
|
||||
|
||||
name = "${interface.device}.hostapd";
|
||||
defaults = {
|
||||
driver = "nl80211";
|
||||
logger_syslog = "-1";
|
||||
logger_syslog_level = 1;
|
||||
ctrl_interface = "/run/hostapd";
|
||||
ctrl_interface_group = 0;
|
||||
};
|
||||
|
||||
conf = writeText "hostapd.conf"
|
||||
(concatStringsSep
|
||||
"\n"
|
||||
(mapAttrsToList
|
||||
(name: value: "${name}=${toString value}")
|
||||
(defaults // params)));
|
||||
in longrun {
|
||||
inherit name;
|
||||
dependencies = [ interface ];
|
||||
run = "${hostapd}/bin/hostapd -i ${interface.device} -P /run/${name}.pid -S ${conf}";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue