2017-11-11 08:53:54 +01:00
|
|
|
{ stdenv, fetchFromGitHub }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-02-28 18:56:35 +01:00
|
|
|
version = "0.6.4";
|
2017-11-11 08:53:54 +01:00
|
|
|
name = "nix-bash-completions-${version}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hedning";
|
|
|
|
repo = "nix-bash-completions";
|
|
|
|
rev = "v${version}";
|
2018-02-28 18:56:35 +01:00
|
|
|
sha256 = "1kdysrfc8dx24q438wj3aisn64g2w5yb6mx91qa385p5hz7b1yz2";
|
2017-11-11 08:53:54 +01:00
|
|
|
};
|
|
|
|
|
2017-12-10 12:41:24 +01:00
|
|
|
# To enable lazy loading via. bash-completion we need a symlink to the script
|
|
|
|
# from every command name.
|
2017-11-11 08:53:54 +01:00
|
|
|
installPhase = ''
|
2017-12-10 12:41:24 +01: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 08:53:54 +01:00
|
|
|
'';
|
|
|
|
|
2017-11-11 17:06:08 +01:00
|
|
|
meta = with stdenv.lib; {
|
2018-01-05 20:42:46 +01:00
|
|
|
homepage = https://github.com/hedning/nix-bash-completions;
|
2017-11-11 08:53:54 +01:00
|
|
|
description = "Bash completions for Nix, NixOS, and NixOps";
|
2017-11-11 17:06:08 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ hedning ];
|
2017-11-11 08:53:54 +01:00
|
|
|
};
|
|
|
|
}
|