From 0a7c1da9f3182e685a08eadd6185803a83a16b59 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 22 Dec 2021 13:21:45 +0100 Subject: [PATCH 1/2] Make bash completion for 'nix' work in a devshell --- flake.nix | 3 +++ 1 file changed, 3 insertions(+) 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 ''; }); From 5b5f68f1dd4395f0ef7231218295d1c633d4288b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 22 Dec 2021 13:26:35 +0100 Subject: [PATCH 2/2] Make bash completion work when nix is invoked as ~/.../nix --- misc/bash/completion.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" }