package: don't run shellHook in nested nix-shells
If a nested nix-shell is run inside a nix-shell, then the outer shell's
shellHook will be passed through and run again, unless the nested shell
defines its own.
With lix's hook, this can be annoying: forgetting to exit its nix-shell,
cd'ing to another repository & entering a nested nix-shell will happily
install lix's pre-commit hook in it.
This change makes lix's hook return early in such cases.
Change-Id: I91cb6eb6668f3a8eace36ecbdb01eb367861d77b
This commit is contained in:
parent
2cd1ef2201
commit
7a12bc2007
|
@ -414,6 +414,8 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
glibcFix
|
glibcFix
|
||||||
// {
|
// {
|
||||||
|
|
||||||
|
name = "lix-shell-env";
|
||||||
|
|
||||||
inputsFrom = [ finalAttrs ];
|
inputsFrom = [ finalAttrs ];
|
||||||
|
|
||||||
# For Meson to find Boost.
|
# For Meson to find Boost.
|
||||||
|
@ -437,6 +439,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
++ finalAttrs.checkInputs;
|
++ finalAttrs.checkInputs;
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
# don't re-run the hook in (other) nested nix-shells
|
||||||
|
if [[ $name != lix-shell-env ]]; then
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
|
||||||
PATH=$prefix/bin:$PATH
|
PATH=$prefix/bin:$PATH
|
||||||
unset PYTHONPATH
|
unset PYTHONPATH
|
||||||
export MANPATH=$out/share/man:$MANPATH
|
export MANPATH=$out/share/man:$MANPATH
|
||||||
|
|
Loading…
Reference in a new issue