shellHook: make it actually run

When we changed this in I91cb6eb6668f3a8eace36ecbdb01eb367861d77b to
not run in nested shells, we didn't predict that `nix develop` would do
something ridiculous and append -env to things silently. `nix-shell` of
course does not do this, so we need to tolerate both.

Change-Id: Ibe7cf546823d7358ebc0414ecbe154e3e3194f45
This commit is contained in:
jade 2024-05-30 13:41:31 -07:00 committed by jade
parent 2f104bbe3b
commit e6e5cacabe

View file

@ -449,7 +449,10 @@ stdenv.mkDerivation (finalAttrs: {
shellHook = '' shellHook = ''
# don't re-run the hook in (other) nested nix-shells # don't re-run the hook in (other) nested nix-shells
function lixShellHook() { function lixShellHook() {
if [[ $name != lix-shell-env ]]; then # n.b. how the heck does this become -env-env? well, `nix develop` does it:
# https://git.lix.systems/lix-project/lix/src/commit/7575db522e9008685c4009423398f6900a16bcce/src/nix/develop.cc#L240-L241
# this is, of course, absurd.
if [[ $name != lix-shell-env && $name != lix-shell-env-env ]]; then
return; return;
fi fi