From c63413d56ea988857e48da356038e00cc3eaccd3 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Sun, 30 Jun 2024 17:23:07 +0530 Subject: [PATCH] handle SIGTERMS --- flake.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 535c15a..03ca3c5 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,12 @@ inherit system; }; package = pkgs.callPackage ./default.nix { }; - app = pkgs.writeShellScriptBin "app" "${pkgs.merecat}/bin/merecat -n -p 8080 ${package}/share/web"; + app = pkgs.writeShellScriptBin "app" '' + trap 'kill "''${child_pid}"; wait "''${child_pid}";' SIGINT SIGTERM + ${pkgs.merecat}/bin/merecat -n -p 8080 ${package}/share/web & + child_pid="$!" + wait "''${child_pid}" + ''; in { formatter = pkgs.nixpkgs-fmt;