forked from dan/liminix
hostapd: get secrets service/path from attrs
This commit is contained in:
parent
ddaa5476d3
commit
97defc2076
@ -10,6 +10,7 @@
|
|||||||
let
|
let
|
||||||
inherit (liminix.services) longrun;
|
inherit (liminix.services) longrun;
|
||||||
inherit (lib) concatStringsSep mapAttrsToList;
|
inherit (lib) concatStringsSep mapAttrsToList;
|
||||||
|
inherit (builtins) map filter attrValues length head typeOf;
|
||||||
|
|
||||||
# This is not a friendly interface to configuring a wireless AP: it
|
# This is not a friendly interface to configuring a wireless AP: it
|
||||||
# just passes everything straight through to the hostapd config.
|
# just passes everything straight through to the hostapd config.
|
||||||
@ -46,14 +47,22 @@ let
|
|||||||
run = ''
|
run = ''
|
||||||
mkdir -p /run/${name}
|
mkdir -p /run/${name}
|
||||||
chmod 0700 /run/${name}
|
chmod 0700 /run/${name}
|
||||||
${output-template}/bin/output-template '{{' '}}' < ${conf} > /run/${name}/hostapd.conf
|
${output-template}/bin/output-template '{{' '}}' < ${conf} > /run/${name}/hostapd.conf
|
||||||
exec ${hostapd}/bin/hostapd -i $(output ${interface} ifname) -P /run/${name}/hostapd.pid -S /run/${name}/hostapd.conf
|
exec ${hostapd}/bin/hostapd -i $(output ${interface} ifname) -P /run/${name}/hostapd.pid -S /run/${name}/hostapd.conf
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
watched-services =
|
||||||
|
(filter (f: typeOf f == "set") (attrValues attrs));
|
||||||
|
|
||||||
in svc.secrets.subscriber.build {
|
in svc.secrets.subscriber.build {
|
||||||
watch = {
|
watch = {
|
||||||
service = attrs.wpa_passphrase.service;
|
service = assert (length watched-services == 1); (head watched-services).service;
|
||||||
paths = ["wpa_passphrase"];
|
paths = unique (
|
||||||
|
map (s: s.path)
|
||||||
|
(filter
|
||||||
|
(f: f.service == (head watched-services).service)
|
||||||
|
watched-services
|
||||||
|
));
|
||||||
};
|
};
|
||||||
inherit service;
|
inherit service;
|
||||||
action = "restart-all";
|
action = "restart-all";
|
||||||
|
Loading…
Reference in New Issue
Block a user