From d76d699a539e9898354219ffe656a871dfe80b15 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 2 Mar 2025 19:12:52 +0300 Subject: [PATCH] fix(3p/overlays): work around buildkite agent issues with nixpkgs Buildkite introduced a weird check that determines whether the bootstrap agent path (?) matches the binary that the agent was started from: https://github.com/buildkite/agent/pull/3123 They did this to work around some internal development flow problems. However, this check is toggled by whether or not the `buildNumber` compile-time variable is set to the special `x` sentinel value. In their publicly released binaries (which we do not use, of course), this is set to some other value. In Nix builds they are at the default sentinel value, causing crashes at startup because of the wrapper script not matching the binary path: ``` buildkite-agent: fatal: check binary paths: mismatched buildkite-agent paths: host="/nix/store/rmp9g00bppi8yimr0ngnx6490w196in8-buildkite-agent-3.89.0/bin/.buildkite-agent-wrapped" bootstrap="/nix/store/rmp9g00bppi8yimr0ngnx6490w196in8-buildkite-agent-3.89.0/bin/buildkite-agent" ``` To work around this we just set the build "number" to `nix`. Change-Id: I794861aeaf63764689148cae841ce56f88752186 Reviewed-on: https://cl.tvl.fyi/c/depot/+/13205 Autosubmit: tazjin Reviewed-by: sterni Tested-by: BuildkiteCI --- third_party/overlays/tvl.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/third_party/overlays/tvl.nix b/third_party/overlays/tvl.nix index e2b697045..91e5816b9 100644 --- a/third_party/overlays/tvl.nix +++ b/third_party/overlays/tvl.nix @@ -33,6 +33,14 @@ depot.nix.readTree.drvTargets { withAWS = false; }); + # see b/439; this fix will be upstreamed in nixpkgs + buildkite-agent = super.buildkite-agent.overrideAttrs (old: { + # once PR#386414 propagates here (& len(ldflags) = 2), we can delete this + ldflags = assert (builtins.length old.ldflags) == 1; old.ldflags ++ [ + "-X github.com/buildkite/agent/v3/version.buildNumber=nix" + ]; + }); + # No longer builds with Nix 2.3 after # https://github.com/nixos/nixpkgs/commit/5f9d2d95721cdf20ace744f2db75ad70a7aedd3a nixos-option = super.nixos-option.override {