From 4053ea948133f67fce23763108f07672ad55461e Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 20 Aug 2024 22:56:26 +0100 Subject: [PATCH] secrets/subscriber implement different restart types --- modules/secrets/subscriber.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/secrets/subscriber.nix b/modules/secrets/subscriber.nix index e9679cb..2b6f87c 100644 --- a/modules/secrets/subscriber.nix +++ b/modules/secrets/subscriber.nix @@ -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: {