From b099ab586fd90ab006fb5ae3adf3aaef950dd738 Mon Sep 17 00:00:00 2001 From: Danielle Lancashire Date: Sat, 4 May 2024 20:32:45 +0000 Subject: [PATCH] k3s: fix go version patch Previously we attempted to ignore Kubernetes upstream build recommendations by reverting the commit in K3S that started trying to enforce them. This commit is no longer cleanly revertable. Now we bypass the detection by overwriting the variable (`version.UpstreamGolang`) with the version we want to use instead (from the `go` input). This allows the package to be cleanly updated again. --- .../networking/cluster/k3s/builder.nix | 16 ++++------------ pkgs/top-level/all-packages.nix | 1 + 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/networking/cluster/k3s/builder.nix b/pkgs/applications/networking/cluster/k3s/builder.nix index b5f017b85b05..e4c7a42fd578 100644 --- a/pkgs/applications/networking/cluster/k3s/builder.nix +++ b/pkgs/applications/networking/cluster/k3s/builder.nix @@ -30,7 +30,6 @@ lib: # It is likely we will have to split out additional builders for additional # versions in the future, or customize this one further. { lib -, fetchpatch , makeWrapper , socat , iptables @@ -56,6 +55,7 @@ lib: , sqlite , nixosTests , pkgsBuildBuild +, go }: # k3s is a kinda weird derivation. One of the main points of k3s is the @@ -93,8 +93,9 @@ let # https://github.com/k3s-io/k3s/blob/5fb370e53e0014dc96183b8ecb2c25a61e891e76/scripts/build#L19-L40 versionldflags = [ - "-X github.com/rancher/k3s/pkg/version.Version=v${k3sVersion}" - "-X github.com/rancher/k3s/pkg/version.GitCommit=${lib.substring 0 8 k3sCommit}" + "-X github.com/k3s-io/k3s/pkg/version.Version=v${k3sVersion}" + "-X github.com/k3s-io/k3s/pkg/version.GitCommit=${lib.substring 0 8 k3sCommit}" + "-X github.com/k3s-io/k3s/pkg/version.UpstreamGolang=go${go.version}" "-X k8s.io/client-go/pkg/version.gitVersion=v${k3sVersion}" "-X k8s.io/client-go/pkg/version.gitCommit=${k3sCommit}" "-X k8s.io/client-go/pkg/version.gitTreeState=clean" @@ -185,15 +186,6 @@ let src = k3sRepo; vendorHash = k3sVendorHash; - patches = - # Disable: Add runtime checking of golang version - (fetchpatch { - # https://github.com/k3s-io/k3s/pull/9054 - url = "https://github.com/k3s-io/k3s/commit/b297996b9252b02e56e9425f55f6becbf6bb7832.patch"; - hash = "sha256-xBOY2jnLhT9dtVKtq26V9QUnuX1q6E/9UcO9IaU719U="; - revert = true; - }); - nativeBuildInputs = [ pkg-config ]; buildInputs = [ libseccomp sqlite.dev ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c0054b6f0a94..2ab0cf2033c8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32216,6 +32216,7 @@ with pkgs; inherit (callPackage ../applications/networking/cluster/k3s { buildGoModule = buildGo121Module; + go = go_1_21; }) k3s_1_26 k3s_1_27 k3s_1_28 k3s_1_29; k3s = k3s_1_29;