I’ve been trying to get autocompletions working with nushell
(by using carapace
) and mostly everything works (including e.g. the nix
command) since carapace provides a lot of completions out of the box, but for example nixos-rebuild
completions do not work.
For these remaining completions carapace tries to bridge completions from bash (I have set the environment variable CARAPACE_BRIDGES
to ‘zsh,fish,bash,inshellisense’), but carapace is a bit dumb in that it looks for bash_completions only in the directories listed here, while NixOS spreads completions across all the $XDG_DATA_DIRS
and in particular the directories where carapace looks are all empty on my system. (I think the completions for the nixos-
commands are mainly in /etc/profiles/per-user/$USERNAME/share/bash-completion/completions
and /run/current-system/sw/share/bash-completion/completions
.)
I thought about trying to symlink the completions into the directories where carapace
expects them, but I am unsure of how that would affect bash (since it also looks into those directories), and also this solution would need to keep up with changes of $XDG_DATA_DIRS
(e.g. I would like to have completions also when using something like nix shell
).
Or maybe I could patch carapace
somehow? If someone had guidance here I’d be open to try, but I have no experience with that.
Is there some other way to get bash completions into other shells, maybe something more robust then carapace?