flyctl: fix reproducibility by extracting VCS info in postCheckout

This commit is contained in:
Schahin Rouhanizadeh
2026-02-27 00:03:43 +01:00
parent b0c4cbb9aa
commit 607216fa16
2 changed files with 23 additions and 7 deletions
+13 -7
View File
@@ -17,12 +17,15 @@ buildGoModule rec {
owner = "superfly";
repo = "flyctl";
rev = "v${version}";
leaveDotGit = true;
hash = "sha256-hzKKCwGTaz1MFQ1+F9piNBnaEDZJwJqoerR1c/uzSsQ=";
postCheckout = ''
cd "$out"
git rev-parse HEAD > COMMIT
'';
hash = "sha256-sH2owlQOB2rRLSKbj6LWwQeuYJUjdqiDxCRKMEBpUbU=";
};
proxyVendor = true;
vendorHash = "sha256-ezGA1LGwQVFMzV/Ogj26pooD06O7FNTXMrYWkv6AwWM=";
vendorHash = "sha256-AaUscVllqhDivsAc5SDbfiXDWPs/x1f7kqdr6Qhf8mg=";
subPackages = [ "." ];
@@ -39,12 +42,15 @@ buildGoModule rec {
git
];
patches = [ ./disable-auto-update.patch ];
patches = [
./disable-auto-update.patch
./set-commit.patch
];
preBuild = ''
# Embed VCS Infos
export GOFLAGS="$GOFLAGS -buildvcs=true"
export GOFLAGS="$GOFLAGS -buildvcs=false"
substituteInPlace internal/buildinfo/buildinfo.go \
--replace '@commit@' "$(cat COMMIT)"
GOOS= GOARCH= CGO_ENABLED=0 go generate ./...
'';
+10
View File
@@ -0,0 +1,10 @@
--- a/internal/buildinfo/buildinfo.go
+++ b/internal/buildinfo/buildinfo.go
@@ -117,6 +117,7 @@ func UserAgent() string {
}
func Commit() string {
+ return "@commit@"
info, _ := debug.ReadBuildInfo()
var rev = "<none>"
var dirty = ""