forked from lix-project/lix
package: return from shellHook correctly
If our shellHook is being run from a nested nix-shell (see 7a12bc200¹), then (I think) it is run from a bash function due to the nesting, then `return` is correct. If its `eval`'d though, then there isn't really a correct way to early exit. So we can just unconditionally be executed in a function. Basically, we have IIFE at home. [1]:7a12bc2007
Change-Id:Iacad25cbbf66cde2911604e6061e56ad6212af7e
This commit is contained in:
parent
68937f2b64
commit
eac3546d50
|
@ -441,6 +441,7 @@ 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() {
|
||||||
if [[ $name != lix-shell-env ]]; then
|
if [[ $name != lix-shell-env ]]; then
|
||||||
return;
|
return;
|
||||||
fi
|
fi
|
||||||
|
@ -467,6 +468,9 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
chmod u+x "$gitcommondir/hooks/commit-msg"
|
chmod u+x "$gitcommondir/hooks/commit-msg"
|
||||||
fi
|
fi
|
||||||
unset gitcommondir
|
unset gitcommondir
|
||||||
|
}
|
||||||
|
|
||||||
|
lixShellHook
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue