handle SIGTERMS

This commit is contained in:
Adithya 2024-06-30 17:23:07 +05:30
parent a8d368c020
commit c63413d56e
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C

View file

@ -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;