2021-01-25 13:26:59 -08:00
|
|
|
{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
|
2020-02-03 18:15:27 -08:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "gh";
|
2021-02-18 12:51:18 -08:00
|
|
|
version = "1.6.1";
|
2020-02-03 18:15:27 -08:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cli";
|
|
|
|
repo = "cli";
|
|
|
|
rev = "v${version}";
|
2021-02-18 12:51:18 -08:00
|
|
|
sha256 = "03bsramq75i5sw08gdmjh94n1xh743mq6h4dzaix78i531x7y34i";
|
2020-02-03 18:15:27 -08:00
|
|
|
};
|
|
|
|
|
2021-02-18 12:51:18 -08:00
|
|
|
vendorSha256 = "0nk5axyr3nd9cbk8wswfhqf25dks22mky3rdn6ba9s0fpxhhkr5g";
|
2020-02-03 18:15:27 -08:00
|
|
|
|
2020-05-15 07:20:36 -07:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
2020-09-16 13:05:20 -07:00
|
|
|
export GO_LDFLAGS="-s -w"
|
2020-05-15 07:20:36 -07:00
|
|
|
make GH_VERSION=${version} bin/gh manpages
|
|
|
|
'';
|
2020-02-03 18:15:27 -08:00
|
|
|
|
2020-05-15 07:20:36 -07:00
|
|
|
installPhase = ''
|
|
|
|
install -Dm755 bin/gh -t $out/bin
|
|
|
|
installManPage share/man/*/*.[1-9]
|
2020-02-03 18:15:27 -08:00
|
|
|
|
|
|
|
for shell in bash fish zsh; do
|
|
|
|
$out/bin/gh completion -s $shell > gh.$shell
|
|
|
|
installShellCompletion gh.$shell
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-01-25 13:26:59 -08:00
|
|
|
# fails with `unable to find git executable in PATH`
|
|
|
|
doCheck = false;
|
2020-08-10 15:27:35 -07:00
|
|
|
|
2020-03-28 16:32:01 -07:00
|
|
|
meta = with lib; {
|
2020-02-03 18:15:27 -08:00
|
|
|
description = "GitHub CLI tool";
|
2020-02-13 15:46:21 -08:00
|
|
|
homepage = "https://cli.github.com/";
|
2020-02-03 18:15:27 -08:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ zowoq ];
|
|
|
|
};
|
2020-05-15 07:20:36 -07:00
|
|
|
}
|