nixfmt-rfc-style
There is nothing in this commit except for the changes made by nix-shell -p nixfmt-rfc-style --run "nixfmt ." If this has mucked up your open branches then sorry about that. You can probably nixfmt them to match before merging
This commit is contained in:
@@ -11,11 +11,17 @@
|
||||
## If you have more than one wireless network interface (e.g.
|
||||
## wlan0, wlan1) you can run an instance of hostapd on each of them.
|
||||
|
||||
{ lib, pkgs, config, ...}:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (pkgs) liminix;
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports = [ ../secrets ];
|
||||
options = {
|
||||
system.service.hostapd = mkOption {
|
||||
|
@@ -1,16 +1,23 @@
|
||||
{
|
||||
liminix
|
||||
, svc
|
||||
, hostapd
|
||||
, output-template
|
||||
, writeText
|
||||
, lib
|
||||
liminix,
|
||||
svc,
|
||||
hostapd,
|
||||
output-template,
|
||||
writeText,
|
||||
lib,
|
||||
}:
|
||||
{ interface, params} :
|
||||
{ interface, params }:
|
||||
let
|
||||
inherit (liminix.services) longrun;
|
||||
inherit (lib) concatStringsSep mapAttrsToList unique ;
|
||||
inherit (builtins) map filter attrValues length head typeOf;
|
||||
inherit (lib) concatStringsSep mapAttrsToList unique;
|
||||
inherit (builtins)
|
||||
map
|
||||
filter
|
||||
attrValues
|
||||
length
|
||||
head
|
||||
typeOf
|
||||
;
|
||||
|
||||
# This is not a friendly interface to configuring a wireless AP: it
|
||||
# just passes everything straight through to the hostapd config.
|
||||
@@ -19,27 +26,31 @@ let
|
||||
# extraParams
|
||||
|
||||
name = "${interface.name}.hostapd";
|
||||
defaults = {
|
||||
defaults = {
|
||||
driver = "nl80211";
|
||||
logger_syslog = "-1";
|
||||
logger_syslog_level = 1;
|
||||
ctrl_interface = "/run/${name}";
|
||||
ctrl_interface_group = 0;
|
||||
};
|
||||
attrs = defaults // params ;
|
||||
literal_or_output = o: ({
|
||||
string = builtins.toJSON;
|
||||
int = builtins.toJSON;
|
||||
lambda = (o: "output(${builtins.toJSON (o "service")}, ${builtins.toJSON (o "path")})");
|
||||
}.${builtins.typeOf o}) o;
|
||||
attrs = defaults // params;
|
||||
literal_or_output =
|
||||
o:
|
||||
(
|
||||
{
|
||||
string = builtins.toJSON;
|
||||
int = builtins.toJSON;
|
||||
lambda = (o: "output(${builtins.toJSON (o "service")}, ${builtins.toJSON (o "path")})");
|
||||
}
|
||||
.${builtins.typeOf o}
|
||||
)
|
||||
o;
|
||||
|
||||
conf =
|
||||
(writeText "hostapd.conf.in"
|
||||
((concatStringsSep
|
||||
"\n"
|
||||
(mapAttrsToList
|
||||
(n : v : "${n}={{ ${literal_or_output v} }}")
|
||||
attrs)) + "\n"));
|
||||
conf = (
|
||||
writeText "hostapd.conf.in" (
|
||||
(concatStringsSep "\n" (mapAttrsToList (n: v: "${n}={{ ${literal_or_output v} }}") attrs)) + "\n"
|
||||
)
|
||||
);
|
||||
service = longrun {
|
||||
inherit name;
|
||||
dependencies = [ interface ];
|
||||
@@ -51,7 +62,8 @@ let
|
||||
'';
|
||||
};
|
||||
watch = filter (f: typeOf f == "lambda") (attrValues attrs);
|
||||
in svc.secrets.subscriber.build {
|
||||
in
|
||||
svc.secrets.subscriber.build {
|
||||
inherit service watch;
|
||||
action = "restart-all";
|
||||
}
|
||||
|
Reference in New Issue
Block a user