rclone: use installShellFiles

This commit is contained in:
zowoq 2020-04-26 13:16:53 +10:00
parent 954eab8ea9
commit 0bead921ca

View file

@ -1,4 +1,4 @@
{ stdenv, buildGoPackage, fetchFromGitHub, buildPackages }:
{ stdenv, buildGoPackage, fetchFromGitHub, buildPackages, installShellFiles }:
buildGoPackage rec {
pname = "rclone";
@ -17,6 +17,8 @@ buildGoPackage rec {
outputs = [ "bin" "out" "man" ];
nativeBuildInputs = [ installShellFiles ];
postInstall =
let
rcloneBin =
@ -25,10 +27,11 @@ buildGoPackage rec {
else stdenv.lib.getBin buildPackages.rclone;
in
''
install -D -m644 $src/rclone.1 $man/share/man/man1/rclone.1
mkdir -p $bin/share/zsh/site-functions $bin/share/bash-completion/completions/
${rcloneBin}/bin/rclone genautocomplete zsh $bin/share/zsh/site-functions/_rclone
${rcloneBin}/bin/rclone genautocomplete bash $bin/share/bash-completion/completions/rclone.bash
installManPage $src/rclone.1
for shell in bash zsh; do
${rcloneBin}/bin/rclone genautocomplete $shell rclone.$shell
installShellCompletion rclone.$shell
done
'';
meta = with stdenv.lib; {