2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub }:
|
2017-11-11 07:53:54 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-03-05 14:08:03 +00:00
|
|
|
version = "0.6.8";
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "nix-bash-completions";
|
2017-11-11 07:53:54 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hedning";
|
|
|
|
repo = "nix-bash-completions";
|
|
|
|
rev = "v${version}";
|
2020-03-05 14:08:03 +00:00
|
|
|
sha256 = "1n5zs6xcnv4bv1hdaypmz7fv4j7dsr4a0ifah99iyj4p5j85i1bc";
|
2017-11-11 07:53:54 +00:00
|
|
|
};
|
|
|
|
|
2017-12-10 11:41:24 +00:00
|
|
|
# To enable lazy loading via. bash-completion we need a symlink to the script
|
|
|
|
# from every command name.
|
2017-11-11 07:53:54 +00:00
|
|
|
installPhase = ''
|
2017-12-10 11:41:24 +00:00
|
|
|
commands=$(
|
|
|
|
function complete() { shift 2; echo "$@"; }
|
|
|
|
shopt -s extglob
|
|
|
|
source _nix
|
|
|
|
)
|
|
|
|
install -Dm444 -t $out/share/bash-completion/completions _nix
|
|
|
|
cd $out/share/bash-completion/completions
|
|
|
|
for c in $commands; do
|
|
|
|
ln -s _nix $c
|
|
|
|
done
|
2017-11-11 07:53:54 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-03-05 14:08:03 +00:00
|
|
|
homepage = "https://github.com/hedning/nix-bash-completions";
|
2017-11-11 07:53:54 +00:00
|
|
|
description = "Bash completions for Nix, NixOS, and NixOps";
|
2017-11-11 16:06:08 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ hedning ];
|
2017-11-11 07:53:54 +00:00
|
|
|
};
|
|
|
|
}
|