aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-12-22 14:44:40 +0100
committerGitHub <noreply@github.com>2021-12-22 14:44:40 +0100
commitddd78391547be5f34f4042fd48124c0ced1f33b2 (patch)
tree76728dc310faa76b3057f1e5312f3c91a71bb745
parentdc83298449d5547926febe24c7bf973341127f60 (diff)
parent5b5f68f1dd4395f0ef7231218295d1c633d4288b (diff)
Merge pull request #5819 from edolstra/devshell-completion
Make bash completion for 'nix' work in a devshell
-rw-r--r--flake.nix3
-rw-r--r--misc/bash/completion.sh2
2 files changed, 4 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 806ed45de..f4fae2a00 100644
--- a/flake.nix
+++ b/flake.nix
@@ -667,6 +667,9 @@
PATH=$prefix/bin:$PATH
unset PYTHONPATH
export MANPATH=$out/share/man:$MANPATH
+
+ # Make bash completion work.
+ XDG_DATA_DIRS+=:$out/share
'';
});
diff --git a/misc/bash/completion.sh b/misc/bash/completion.sh
index bea2a40bc..0af90d8c1 100644
--- a/misc/bash/completion.sh
+++ b/misc/bash/completion.sh
@@ -13,7 +13,7 @@ function _complete_nix {
else
COMPREPLY+=("$completion")
fi
- done < <(NIX_GET_COMPLETIONS=$cword "${words[@]}")
+ done < <(NIX_GET_COMPLETIONS=$cword "${words[@]/#\~/$HOME}")
__ltrim_colon_completions "$cur"
}