depot/third_party/nixpkgs/pkgs/applications/version-management/git-and-tools/gh/default.nix
Default email 58f8944c92 Project import generated by Copybara.
GitOrigin-RevId: 5aba0fe9766a7201a336249fd6cb76e0d7ba2faf
2020-09-24 23:45:31 -05:00

43 lines
964 B
Nix

{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
buildGoModule rec {
pname = "gh";
version = "1.0.0";
src = fetchFromGitHub {
owner = "cli";
repo = "cli";
rev = "v${version}";
sha256 = "10ixjrb56ddqxla7mfxqnf74zissjx66akcyvgl9xfmww0bvg64x";
};
vendorSha256 = "079zbm57xfcskwhsfj1x0c0lg6ip6c6dbk8hfwrzkpy8gfs2ysmr";
nativeBuildInputs = [ installShellFiles ];
buildPhase = ''
export GO_LDFLAGS="-s -w"
make GH_VERSION=${version} bin/gh manpages
'';
installPhase = ''
install -Dm755 bin/gh -t $out/bin
installManPage share/man/*/*.[1-9]
for shell in bash fish zsh; do
$out/bin/gh completion -s $shell > gh.$shell
installShellCompletion gh.$shell
done
'';
checkPhase = ''
make test
'';
meta = with lib; {
description = "GitHub CLI tool";
homepage = "https://cli.github.com/";
license = licenses.mit;
maintainers = with maintainers; [ zowoq ];
};
}