From 13069415fd5cc69ab71432b1bc588b150d13a500 Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Sat, 7 Sep 2024 21:12:36 +0200 Subject: [PATCH] feat(modules/hostapd): offer readiness oneshot WLAN oper wait until the WLAN interface is ready. Signed-off-by: Raito Bezarius --- modules/hostapd/default.nix | 11 +++++++++++ modules/hostapd/ready.nix | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 modules/hostapd/ready.nix diff --git a/modules/hostapd/default.nix b/modules/hostapd/default.nix index 4338e74..67f4f72 100644 --- a/modules/hostapd/default.nix +++ b/modules/hostapd/default.nix @@ -20,6 +20,10 @@ in { system.service.hostapd = mkOption { type = liminix.lib.types.serviceDefn; }; + + system.service.hostapd-ready = mkOption { + type = liminix.lib.types.serviceDefn; + }; }; config = { system.service.hostapd = liminix.callService ./service.nix { @@ -34,5 +38,12 @@ in { type = types.attrs; }; }; + + system.service.hostapd-ready = liminix.callService ./ready.nix { + interface = mkOption { + type = liminix.lib.types.interface; + description = "Interface for which to wait that the oper state Master or Master (VLAN) has been reached."; + }; + }; }; } diff --git a/modules/hostapd/ready.nix b/modules/hostapd/ready.nix new file mode 100644 index 0000000..7c10c32 --- /dev/null +++ b/modules/hostapd/ready.nix @@ -0,0 +1,16 @@ +{ + liminix +, ifwait +, lib +}: +{ interface } : +let + inherit (liminix.services) oneshot; +in oneshot { + name = "${interface.name}.wlan-oper"; + up = '' + ${ifwait}/bin/ifbridgeable -v $(output ${interface} ifname) + ''; + + dependencies = [ interface ]; +}