nixpkgs-suyu/pkgs/applications/version-management/git-and-tools/gh/default.nix

36 lines
869 B
Nix

{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
buildGoModule rec {
pname = "gh";
version = "0.7.0";
src = fetchFromGitHub {
owner = "cli";
repo = "cli";
rev = "v${version}";
sha256 = "054mag8jgxkvx2f95ha10n45v4xv5lms69w76g95z18m62qhjcyl";
};
modSha256 = "0v33x9bnwjfg4425vralnsb4i22c0g1rcmaga9911v0i7d51k0fn";
buildFlagsArray = [
"-ldflags=-s -w -X github.com/cli/cli/command.Version=${version}"
];
subPackages = [ "cmd/gh" ];
nativeBuildInputs = [ installShellFiles ];
postInstall = ''
for shell in bash fish zsh; do
$out/bin/gh completion -s $shell > gh.$shell
installShellCompletion gh.$shell
done
'';
meta = with lib; {
description = "GitHub CLI tool";
homepage = "https://cli.github.com/";
license = licenses.mit;
maintainers = with maintainers; [ zowoq ];
};
}