gh: fix --version showing date in the 80s

This commit is contained in:
Antoine du Hamel 2025-04-26 10:59:32 +02:00 committed by zowoq
parent 42bb244ece
commit 5ca2c4b225

View file

@ -23,9 +23,11 @@ buildGoModule rec {
nativeBuildInputs = [ installShellFiles ];
# N.B.: using the Makefile is intentional.
# We pass "nixpkgs" for build.Date to avoid `gh --version` reporting a very old date.
buildPhase = ''
runHook preBuild
make GO_LDFLAGS="-s -w" GH_VERSION=${version} bin/gh ${lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) "manpages"}
make GO_LDFLAGS="-s -w -X github.com/cli/cli/v${lib.versions.major version}/internal/build.Date=nixpkgs" GH_VERSION=${version} bin/gh ${lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) "manpages"}
runHook postBuild
'';