commit 33f2a9348943056ecf0dc9b050c7e64a713a4800
parent d0376d41016e0ddbd532b63f7fd3b2f4fcbcdf37
Author: Peter Collingbourne <peter@pcc.me.uk>
Date: Sun, 3 May 2026 00:37:12 -0700
ifwait: React to interface up by bringing up the service tree
This allows a system to be configured to dynamically bring up services
associated with an interface. For example, attaching a USB ethernet
adapter could trigger starting a DHCP client and an additional default
route for failover to an additional upstream.
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/pkgs/ifwait/default.nix b/pkgs/ifwait/default.nix
@@ -3,6 +3,8 @@
writeFennel,
runCommand,
anoia,
+ lualinux,
+ s6-rc-up-tree,
}:
runCommand "ifwait" { } ''
mkdir -p $out/bin
@@ -10,7 +12,9 @@ runCommand "ifwait" { } ''
writeFennel "ifwait" {
packages = [
anoia
+ lualinux
netlink-lua
+ s6-rc-up-tree
];
} ./ifwait.fnl
} $out/bin/ifwait
diff --git a/pkgs/ifwait/ifwait.fnl b/pkgs/ifwait/ifwait.fnl
@@ -37,7 +37,7 @@
(when (not (= up wanted?))
(set up
(if wanted?
- (pcall system (.. "s6-rc -b -u change " service))
+ (pcall system (.. "s6-rc-up-tree " service))
(not (pcall system (.. "s6-rc -b -d change " service)))))
))