From 33f2a9348943056ecf0dc9b050c7e64a713a4800 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Sun, 3 May 2026 00:37:12 -0700 Subject: [PATCH] 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. --- pkgs/ifwait/default.nix | 4 ++++ pkgs/ifwait/ifwait.fnl | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/ifwait/default.nix b/pkgs/ifwait/default.nix index 9383a28..0ba6f64 100644 --- 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 index cc5e76c..f6d6291 100644 --- 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))))) ))