I’m working on small nix flake to standardize the developer environments at my job.
What I’m still missing, however, is a way to clean up after leaving the shell. Some hook to call a shell script, when the shell is closed.
Is there something like this? I thought about wrapping the actual nix develop
call inside a bash script and waiting for nix to terminate, but that seems rather hacky.
Sounds like the perfect use case for devenv. I use it in a handful of personal projects and it’s proved to be very useful when swapping projects especially when they require multiple services (eg. postgres, redis, nginx, etc.)
It can be setup as a flake that you can use with
nix develop
.There’s options to start services and you can use scripts if you want some easy ways to tear down environments while in the devenv shell.
Hope this helps.