forked from lix-project/lix
devShell: guard against running from another directory
I was working on nix-eval-jobs with a dev shell with some shenanigans to
run against a locally built Lix and it was getting really annoying when
`nix develop ../lix#` was messing up my other git repo's hooks.
This is a fix via blunt force, but it is at least obvious how it works.
Change-Id: Ia29eeb5be57ab6a2c88451c00ea18a51e4dfe65e
This commit is contained in:
parent
eb5de71adc
commit
d5637ee790
1
.this-is-lix
Normal file
1
.this-is-lix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
This is a file used by the dev shell shellHook in package.nix to check that this is actually a Lix repo before installing git hooks. Its contents have no meaning.
|
|
@ -476,7 +476,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
# https://git.lix.systems/lix-project/lix/src/commit/7575db522e9008685c4009423398f6900a16bcce/src/nix/develop.cc#L240-L241
|
# https://git.lix.systems/lix-project/lix/src/commit/7575db522e9008685c4009423398f6900a16bcce/src/nix/develop.cc#L240-L241
|
||||||
# this is, of course, absurd.
|
# this is, of course, absurd.
|
||||||
if [[ $name != lix-shell-env && $name != lix-shell-env-env ]]; then
|
if [[ $name != lix-shell-env && $name != lix-shell-env-env ]]; then
|
||||||
return;
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PATH=$prefix/bin:$PATH
|
PATH=$prefix/bin:$PATH
|
||||||
|
@ -486,6 +486,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
# Make bash completion work.
|
# Make bash completion work.
|
||||||
XDG_DATA_DIRS+=:$out/share
|
XDG_DATA_DIRS+=:$out/share
|
||||||
|
|
||||||
|
if [[ ! -f ./.this-is-lix ]]; then
|
||||||
|
echo "Dev shell not started from inside a Lix repo, skipping repo setup" >&2
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
${lib.optionalString (pre-commit-checks ? shellHook) pre-commit-checks.shellHook}
|
${lib.optionalString (pre-commit-checks ? shellHook) pre-commit-checks.shellHook}
|
||||||
# Allow `touch .nocontribmsg` to turn this notice off.
|
# Allow `touch .nocontribmsg` to turn this notice off.
|
||||||
if ! [[ -f .nocontribmsg ]]; then
|
if ! [[ -f .nocontribmsg ]]; then
|
||||||
|
|
Loading…
Reference in a new issue