Hello!
I am new to nixOS and I have just successfully added an executable bash script using home-manager with the following:
{
home.packages = [
(pkgs.writeShellApplication {
name = "HelloWorld";
text = builtins.readFile ./hello-world.sh;
})
];
}
I want to add another script I have that uses git completion like so:
if [ -f "/usr/share/bash-completion/completions/git" ]; then
source /usr/share/bash-completion/completions/git
__git_complete git_delete_branch _git_branch
else
echo "Error loading git completions"
fi
However because bash-completion lives in my nix store this logic doesn’t work on nix.
What is the nix way to successfully add bash-git-completion?
My current understanding is that I can a) resolve the bash git completion path in my script, or to b) add a copy of bash git completion as a dependency file and package it with my script with mkDerivation.
I am unsure how to do both, and would really appreciate any advice.
Thanks!