From 8ac2c6cec18151e13959db4c11c3d70106965250 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sat, 16 Mar 2024 23:08:59 +0000 Subject: [PATCH] support timeouts (default 30s) for starting s6-rc services --- pkgs/liminix-tools/services/builder.sh | 2 +- pkgs/liminix-tools/services/default.nix | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/liminix-tools/services/builder.sh b/pkgs/liminix-tools/services/builder.sh index a0b6778..744a86e 100644 --- a/pkgs/liminix-tools/services/builder.sh +++ b/pkgs/liminix-tools/services/builder.sh @@ -11,7 +11,7 @@ test -n "$contents" && for d in $contents; do touch $out/${name}/contents.d/$d 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) done diff --git a/pkgs/liminix-tools/services/default.nix b/pkgs/liminix-tools/services/default.nix index d851cd9..045459a 100644 --- a/pkgs/liminix-tools/services/default.nix +++ b/pkgs/liminix-tools/services/default.nix @@ -31,6 +31,8 @@ let , producer-for ? null , consumer-for ? null , pipeline-name ? null + , timeout-up ? 30000 # milliseconds + , timeout-down ? 0 , dependencies ? [] , contents ? [] , buildInputs ? [] @@ -39,7 +41,7 @@ let # we use stdenvNoCC to avoid generating derivations with names # like foo.service-mips-linux-musl 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; dependencies = builtins.map (d: d.name) dependencies; contents = builtins.map (d: d.name) contents;