users/services: s6: `exec` into the run/finish commands
This commit is contained in:
parent
16ca71188f
commit
4fa7e6113d
|
@ -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
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue