shellHook = ''
PS1="\[\e[1;32m\][(${nix_shell_name})\u@\h:\w]\$\[\e[0m\] "
docker start mariadb-temp >/dev/null 2>&1 || true
setsid python-service </dev/null >/dev/null 2>&1 &
SERVICE_PID=$!
trap '
docker stop mariadb-temp >/dev/null 2>&1 || true
kill $SERVICE_PID 2>/dev/null || true
' EXIT INT TERM
'';
So I have a shellHook which looks like the above, its inteded purpose is to start docker and python-service and then trap and kill them upon shell exit.
The above successfully kills the process upon exit if I use nix develop but does not when I use nix develop -c $env.SHELL (I am using nushell btw)
How can I get it to kill the process on nix develop -c $env.SHELL
I guess I could add
exec nu to the end of my shellHook and just use the command nix develop but that feels a bit ad-hoc as the flake shouldn’t choose the shell.
Thoughts?
Thanks for the help,
Vatsa