support timeouts (default 30s) for starting s6-rc services

This commit is contained in:
Daniel Barlow 2024-03-16 23:08:59 +00:00
parent 8879b2d1ba
commit 8ac2c6cec1
2 changed files with 4 additions and 2 deletions

View file

@ -11,7 +11,7 @@ test -n "$contents" && for d in $contents; do
touch $out/${name}/contents.d/$d touch $out/${name}/contents.d/$d
done done
for i in run notification-fd up down consumer-for producer-for pipeline-name ; do for i in timeout-up timeout-down run notification-fd up down consumer-for producer-for pipeline-name ; do
test -n "$(printenv $i)" && (echo "$(printenv $i)" > $out/${name}/$i) test -n "$(printenv $i)" && (echo "$(printenv $i)" > $out/${name}/$i)
done done

View file

@ -31,6 +31,8 @@ let
, producer-for ? null , producer-for ? null
, consumer-for ? null , consumer-for ? null
, pipeline-name ? null , pipeline-name ? null
, timeout-up ? 30000 # milliseconds
, timeout-down ? 0
, dependencies ? [] , dependencies ? []
, contents ? [] , contents ? []
, buildInputs ? [] , buildInputs ? []
@ -39,7 +41,7 @@ let
# we use stdenvNoCC to avoid generating derivations with names # we use stdenvNoCC to avoid generating derivations with names
# like foo.service-mips-linux-musl # like foo.service-mips-linux-musl
inherit name serviceType up down run notification-fd inherit name serviceType up down run notification-fd
producer-for consumer-for pipeline-name; producer-for consumer-for pipeline-name timeout-up timeout-down;
buildInputs = buildInputs ++ dependencies ++ contents; buildInputs = buildInputs ++ dependencies ++ contents;
dependencies = builtins.map (d: d.name) dependencies; dependencies = builtins.map (d: d.name) dependencies;
contents = builtins.map (d: d.name) contents; contents = builtins.map (d: d.name) contents;