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