Hello, is there such a thing as shellExitHook which runs when I exit a shell? (On a best effort basis, or at least when I cleanly exit a nix-shell?)
Currently I do:
shellHook = ''
./shellHook.sh
trap "shellExitHook.sh" EXIT
'';
Hello, is there such a thing as shellExitHook which runs when I exit a shell? (On a best effort basis, or at least when I cleanly exit a nix-shell?)
Currently I do:
shellHook = ''
./shellHook.sh
trap "shellExitHook.sh" EXIT
'';
not to my knowledge. And looking at pkgs/build-support/mkshell/default.nix
there doesn’t appear to be. trap seems like an interesting possibility.
it’s definitely possible!
nix-shell -E '
with import <nixpkgs> {}; mkShell {
shellHook = "PS0=$PS1 bash --rcfile ${writeText "rcfile" "export PS1=$PS0"} -i;
echo EXIT HOOK CODE HERE;
exit
";
}'
but trap is also fine.