diff --git a/pkgs/applications/version-management/gh/default.nix b/pkgs/applications/version-management/gh/default.nix index 2f79120759ca999..d08f41852b7ded4 100644 --- a/pkgs/applications/version-management/gh/default.nix +++ b/pkgs/applications/version-management/gh/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, buildGoModule, installShellFiles, testers, gh }: +{ lib, fetchFromGitHub, buildGoModule, installShellFiles, stdenv, testers, gh }: buildGoModule rec { pname = "gh"; @@ -15,27 +15,23 @@ buildGoModule rec { 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 + make GO_LDFLAGS="-s -w" GH_VERSION=${version} bin/gh ${lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) "manpages"} runHook postBuild ''; installPhase = '' runHook preInstall install -Dm755 bin/gh -t $out/bin + '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' installManPage share/man/*/*.[1-9] installShellCompletion --cmd gh \ --bash <($out/bin/gh completion -s bash) \ --fish <($out/bin/gh completion -s fish) \ --zsh <($out/bin/gh completion -s zsh) + '' + '' runHook postInstall '';