Konubinix' opinionated web of thoughts

Bash-Completion

Fleeting

bash-completion

where does bash completion look for completion

where does bash completion look for completion

see </usr/share/bash-completion/bash_completion>

It uses the path of the binary to complete and looks for ../share/bash-completion/completions from there. Therefore, installing stuff with nix is enough. There is no need

# 3) From bin directories extracted from the specified path to the command,
# the real path to the command, and $PATH
paths=()
[[ $cmd == /* ]] && paths+=("${cmd%/*}")
_comp_realcommand "$cmd" && paths+=("${REPLY%/*}")
_comp_split -aF : paths "$PATH"
for dir in "${paths[@]%/}"; do
    [[ $dir == ?*/@(bin|sbin) ]] &&
        dirs+=("${dir%/*}/share/bash-completion/completions")
done

Then later, it tries to find the completion script in it and source it if it finds it.

Notes linking here