From 4fa7e6113d6a0400ca134bc0f3f6252aa03e22bf Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 21 Mar 2024 16:18:31 +0000 Subject: [PATCH] users/services: s6: `exec` into the run/finish commands --- modules/users/s6-rc.nix | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/modules/users/s6-rc.nix b/modules/users/s6-rc.nix index 1c5e92f3..d5b08a4c 100644 --- a/modules/users/s6-rc.nix +++ b/modules/users/s6-rc.nix @@ -73,35 +73,33 @@ let serviceToFs'= { name, type, - contents ? null, - run ? null, + consumerFor ? null, + contents ? null, #< bundle contents depends ? [], finish ? null, producerFor ? null, - consumerFor ? null, + run ? null, }: { "${name}".dir = { "type".text = type; - # TODO: finish and run should `exec` into their cli - "finish".executable = maybe (finish != null) '' - #!/bin/sh - ${finish} - ''; - "run".executable = maybe (run != null) '' - #!/bin/sh - echo "starting: s6-${name}" - ${run} 2>&1 - ''; "contents".text = maybe (contents != null) ( lib.concatStringsSep "\n" contents ); - # TODO: a bundle can also have dependencies + "consumer-for".text = maybe (consumerFor != null) consumerFor; "dependencies.d".dir = lib.genAttrs depends (dep: { text = ""; }) ; - "consumer-for".text = maybe (consumerFor != null) consumerFor; + "finish".executable = maybe (finish != null) '' + #!/bin/sh + exec ${finish} + ''; "producer-for".text = maybe (producerFor != null) producerFor; + "run".executable = maybe (run != null) '' + #!/bin/sh + echo "starting: s6-${name}" + exec ${run} 2>&1 + ''; }; };