move some secret-watching stuff from hostapd to secrets

This commit is contained in:
Daniel Barlow
2024-08-20 21:49:11 +01:00
parent 97defc2076
commit 264d83c98d
3 changed files with 25 additions and 28 deletions

View File

@@ -9,7 +9,7 @@
{ interface, params} :
let
inherit (liminix.services) longrun;
inherit (lib) concatStringsSep mapAttrsToList;
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
@@ -51,19 +51,9 @@ let
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));
watch = filter (f: typeOf f == "set") (attrValues attrs);
in svc.secrets.subscriber.build {
watch = {
service = assert (length watched-services == 1); (head watched-services).service;
paths = unique (
map (s: s.path)
(filter
(f: f.service == (head watched-services).service)
watched-services
));
};
inherit watch;
inherit service;
action = "restart-all";
}