From 3a6fc0a7643da7c4273499d5b73060e319fa11da Mon Sep 17 00:00:00 2001 From: Robert Rose Date: Wed, 26 Nov 2025 17:02:01 +0100 Subject: [PATCH] k3s: replace go list command to work with vendored dependencies --- pkgs/applications/networking/cluster/k3s/builder.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/applications/networking/cluster/k3s/builder.nix b/pkgs/applications/networking/cluster/k3s/builder.nix index 2e002dd47777..ddb5a5221440 100644 --- a/pkgs/applications/networking/cluster/k3s/builder.nix +++ b/pkgs/applications/networking/cluster/k3s/builder.nix @@ -355,6 +355,13 @@ buildGoModule (finalAttrs: { GOARCH="${pkgsBuildBuild.go.GOARCH}" \ CC="${pkgsBuildBuild.stdenv.cc}/bin/cc" \ "''${GO}" generate' + + # Add the -e flag to process "errornous" packages. We need to modify this because the upstream + # build-time version detection doesn't work with a vendor directory. + substituteInPlace scripts/version.sh \ + --replace-fail \ + "go list -mod=readonly -m -f '{{if .Replace}}{{.Replace.Version}}{{else}}{{.Version}}{{end}}' \$1" \ + "go list -mod=readonly -e -m -f '{{if .Replace}}{{.Replace.Version}}{{else}}{{.Version}}{{end}}' \$1" ''; # Important utilities used by the kubelet, see