secrets/subscriber implement different restart types

This commit is contained in:
Daniel Barlow 2024-08-20 22:56:26 +01:00
parent 54d3415885
commit 4053ea9481
1 changed files with 14 additions and 1 deletions

View File

@ -11,6 +11,19 @@ let
watched-services = unique (map (f: f.service) watch);
paths = unique (map (f: f.path) watch);
restart-flag = {
restart = "-r";
restart-all = "-R";
"hup" = "-s 1";
"int" = "-s 2";
"quit" = "-s 3";
"kill" = "-s 9";
"term" = "-s 15";
"winch" = "-s 28";
"usr1" = "-s 10";
"usr2" = "-s 12";
}.${action};
watched-service =
if length watched-services == 0
then null
@ -26,7 +39,7 @@ let
if test -e $dir/notification-fd; then flag="-U"; else flag="-u"; fi
${s6}/bin/s6-svwait $flag /run/service/${name} || exit
PATH=${s6-rc}/bin:${s6}/bin:$PATH
${watch-outputs}/bin/watch-outputs -r ${name} ${watched-service.name} ${lib.concatStringsSep " " paths}
${watch-outputs}/bin/watch-outputs ${restart-flag} ${name} ${watched-service.name} ${lib.concatStringsSep " " paths}
'';
};
in service.overrideAttrs(o: {