2020-04-24 23:36:52 +00:00
|
|
|
{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "gh";
|
2022-03-30 09:31:56 +00:00
|
|
|
version = "2.6.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cli";
|
|
|
|
repo = "cli";
|
|
|
|
rev = "v${version}";
|
2022-03-30 09:31:56 +00:00
|
|
|
sha256 = "sha256-NvVm/deO4LSIl5TSziqsrGt9atCXjt4UZ/VJfmX3i4c=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
vendorSha256 = "sha256-pBjg6WyD61+Bl3ttcpl/b9XoWBCi7cDvE8NPaZGu7Aw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
2021-04-17 00:35:05 +00:00
|
|
|
# upstream unsets these to handle cross but it breaks our build
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "GOOS= GOARCH= GOARM= GOFLAGS= CGO_ENABLED=" ""
|
|
|
|
'';
|
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
buildPhase = ''
|
2021-04-17 00:35:05 +00:00
|
|
|
runHook preBuild
|
|
|
|
make GO_LDFLAGS="-s -w" GH_VERSION=${version} bin/gh manpages
|
|
|
|
runHook postBuild
|
2020-05-29 06:06:01 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
installPhase = ''
|
2021-04-17 00:35:05 +00:00
|
|
|
runHook preInstall
|
2020-05-29 06:06:01 +00:00
|
|
|
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
|
2021-04-17 00:35:05 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
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/";
|
2021-12-06 16:07:01 +00:00
|
|
|
changelog = "https://github.com/cli/cli/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ zowoq ];
|
|
|
|
};
|
2020-05-29 06:06:01 +00:00
|
|
|
}
|