Fix nix-direnv

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-01-31 10:31:24 +00:00
parent 9917cecf15
commit 8692df6e2f

View File

@@ -36,7 +36,7 @@
while getopts "s:h" opt; do
case $opt in
s)
devshell=$OPTARG
devshell="$OPTARG"
;;
h)
hide=true
@@ -55,9 +55,9 @@
echo "use flake self#$devshell" > .envrc
fi
if hide && git rev-parse --is-inside-work-tree &>/dev/null; then
if "$hide" && git rev-parse --is-inside-work-tree &>/dev/null; then
local top
top=$(git rev-parse --show-toplevel)
top="$(git rev-parse --show-toplevel)"
if ! grep -q "^\.envrc$" "$top/.gitignore" "$top/.git/info/exclude"; then echo "$(realpath --relative-to="$top" .envrc)" >> "$top/.git/info/exclude"; fi
if [ -z "$devshell" ]; then
if ! grep -q "^flake.nix$" "$top/.gitignore" "$top/.git/info/exclude"; then echo "flake.nix" >> "$top/.git/info/exclude"; fi