(address . bug-guix@gnu.org)
I don't install bash-completion into my system profile and I use only
guix home to install user packages. I typically don't guix install any
packages.
While I do include the bash-completion package in my home configuration
file, the completion bash functions do not get loaded as needed, the
resulting user experience is as if bash-completion wasn't installed,
although .bashrc is edited in the typical way to load the main file
bash_completion. But, the shell code in bash_completion cannot find and
load the individual files containing the completion functions for
individual commands.
The reason is that I don't have a ~/.guix-profile folder, my current
user profile is linked in ~/.guix-home/profile. The relevant path (in
my case) is not included in the search path for completion bash functions.
In guix this completion functions search path is defined by the patch found at
gnu/packages/patches/bash-completion-directories.patch, where you can
see the path to the guix home user profile is missing.
The patch below is a patch to the patch file I mention above from the
guix dource tree. It just adds 2 folders to the search path.
I verified that it works for me.
---
bash-completion: fix loading of completion functions with guix home
* gnu/packages/patches/bash-completion-directories.patch: modified
---
gnu/packages/patches/bash-completion-directories.patch | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Toggle diff (26 lines)
diff --git a/gnu/packages/patches/bash-completion-directories.patch b/gnu/packages/patches/bash-completion-directories.patch
index 021e34653b..3c6b3082ea 100644
--- a/gnu/packages/patches/bash-completion-directories.patch
+++ b/gnu/packages/patches/bash-completion-directories.patch
@@ -10,7 +10,7 @@ This is what this patch does.
--- a/bash_completion
+++ b/bash_completion
-@@ -2016,7 +2016,13 @@ complete -F _minimal ''
+@@ -2016,7 +2016,15 @@ complete -F _minimal ''
__load_completion()
{
@@ -19,6 +19,8 @@ This is what this patch does.
+ ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions
+ "$HOME/.guix-profile/share/bash-completion/completions/$base"
+ "$HOME/.guix-profile/etc/bash_completion.d/$base"
++ "$HOME/.guix-home/profile/share/bash-completion/completions/$base"
++ "$HOME/.guix-home/profile/etc/bash_completion.d/$base"
+ "/run/current-system/profile/share/bash-completion/completions/$base"
+ "/run/current-system/profile/etc/bash_completion.d/$base" )
+
base-commit: 47c11772dfe840a536ed7ec438fe832878f51054
--
2.36.1