Skip to content

Commit d0f6fd3

Browse files
fix(direnv): remove dependence on local script
Signed-off-by: Cameron Smith <cameron.ray.smith@gmail.com>
1 parent cbea6fd commit d0f6fd3

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

.envrc

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
./scripts/set-git-env.sh
2-
31
if has nix; then
42
watch_file \
53
nix/modules/*.nix \
@@ -9,9 +7,25 @@ if has nix; then
97
then
108
echo "nix flake could not be built; update flake.nix and run direnv allow/reload" >&2
119
fi
12-
printf "\nrun \`nix flake update --impure && nix flake check --impure\` to update the flake lockfile."
13-
printf "\nuse \`direnv revoke\` to unload the dev environment or \`direnv allow\` to reload it.\n\n"
10+
11+
12+
printf "\nrun \`nix flake update --impure && nix flake check --impure\` to update the flake lockfile.\n"
13+
printf "use \`direnv revoke\` to unload the dev environment or \`direnv allow\` to reload it.\n"
1414
else
15+
# The equivalent nix shell application set-git-env is now run automatically
16+
# via shellHook and the variables are already exported to the environment.
17+
# Fallback to the local script if Nix isn't available or disable if it's not
18+
# executable.
19+
if [ -f ./scripts/set-git-env.sh ]; then
20+
if [ -x ./scripts/set-git-env.sh ]; then
21+
./scripts/set-git-env.sh
22+
else
23+
echo "Warning: scripts/set-git-env.sh exists but is not executable. Run 'chmod +x ./scripts/set-git-env.sh' to make it executable."
24+
fi
25+
else
26+
echo "Warning: scripts/set-git-env.sh not found and Nix not available"
27+
fi
28+
1529
printf "\nNix is not installed or not available in your PATH. You can either:\n"
1630
printf "1. Run \`make bootstrap\` from the Makefile to set up nix\n"
1731
printf "2. Visit https://nix.dev to find instructions on installing nix\n\n"

0 commit comments

Comments
 (0)