aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.this-is-lix1
-rw-r--r--package.nix7
2 files changed, 7 insertions, 1 deletions
diff --git a/.this-is-lix b/.this-is-lix
new file mode 100644
index 000000000..b7ad8ef98
--- /dev/null
+++ b/.this-is-lix
@@ -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.
diff --git a/package.nix b/package.nix
index ef6f317e8..988379618 100644
--- a/package.nix
+++ b/package.nix
@@ -476,7 +476,7 @@ stdenv.mkDerivation (finalAttrs: {
# 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
PATH=$prefix/bin:$PATH
@@ -486,6 +486,11 @@ stdenv.mkDerivation (finalAttrs: {
# Make bash completion work.
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}
# Allow `touch .nocontribmsg` to turn this notice off.
if ! [[ -f .nocontribmsg ]]; then