3e2acf8aff
GitOrigin-RevId: d42cd445dde587e9a993cd9434cb43da07c4c5de
51 lines
1.2 KiB
Nix
51 lines
1.2 KiB
Nix
{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
|
|
|
|
buildGoModule rec {
|
|
pname = "gh";
|
|
version = "1.10.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "cli";
|
|
repo = "cli";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-hI4kV7Xj0oMEfD6SzZ+KWHmMp9yGtr18HPPwkOpr5JA=";
|
|
};
|
|
|
|
vendorSha256 = "sha256-A7Bo0HQ5Z2SXY32jWCYgwvvInD3xYLSXvipzeaQTDiM=";
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
# upstream unsets these to handle cross but it breaks our build
|
|
postPatch = ''
|
|
substituteInPlace Makefile \
|
|
--replace "GOOS= GOARCH= GOARM= GOFLAGS= CGO_ENABLED=" ""
|
|
'';
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
make GO_LDFLAGS="-s -w" GH_VERSION=${version} bin/gh manpages
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
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
|
|
runHook postInstall
|
|
'';
|
|
|
|
# fails with `unable to find git executable in PATH`
|
|
doCheck = false;
|
|
|
|
meta = with lib; {
|
|
description = "GitHub CLI tool";
|
|
homepage = "https://cli.github.com/";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ zowoq ];
|
|
};
|
|
}
|