From 727809f534ff37bb5e4486084a7125b04a175373 Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Fri, 16 May 2025 21:31:51 -0700 Subject: [PATCH 1/3] nixos/k3s: get tests working again Some of the attributes fetched throw, so tryEval them. Recurse into the attribute set to pick up all the tests. --- nixos/tests/k3s/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nixos/tests/k3s/default.nix b/nixos/tests/k3s/default.nix index 4ee3cb760b39..5240f029139f 100644 --- a/nixos/tests/k3s/default.nix +++ b/nixos/tests/k3s/default.nix @@ -4,9 +4,11 @@ lib ? pkgs.lib, }: let - allK3s = lib.filterAttrs (n: _: lib.strings.hasPrefix "k3s_" n) pkgs; + allK3s = lib.filterAttrs ( + n: _: lib.strings.hasPrefix "k3s_" n && (builtins.tryEval pkgs.${n}).success + ) pkgs; in -{ +lib.recurseIntoAttrs { airgap-images = lib.mapAttrs ( _: k3s: import ./airgap-images.nix { inherit system pkgs k3s; } ) allK3s; From 44d7b6dd7bab8ff7fc71da3ba91eb09e5d19d83f Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Fri, 16 May 2025 21:29:56 -0700 Subject: [PATCH 2/3] k3s: use util-linuxMinimal The full version of util-linux has systemd, NLS, and ncurses support. k3s only uses a couple utilities from it at runtime, so use the minimal version. --- pkgs/applications/networking/cluster/k3s/builder.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/cluster/k3s/builder.nix b/pkgs/applications/networking/cluster/k3s/builder.nix index fdd70a653ee5..5e23e64a3cbc 100644 --- a/pkgs/applications/networking/cluster/k3s/builder.nix +++ b/pkgs/applications/networking/cluster/k3s/builder.nix @@ -69,7 +69,7 @@ lib: sqlite, stdenv, systemd, - util-linux, + util-linuxMinimal, yq-go, zstd, }: @@ -377,7 +377,7 @@ buildGoModule rec { ipset bridge-utils ethtool - util-linux # kubelet wants 'nsenter' from util-linux: https://github.com/kubernetes/kubernetes/issues/26093#issuecomment-705994388 + util-linuxMinimal # kubelet wants 'nsenter' and 'mount' from util-linux: https://github.com/kubernetes/kubernetes/issues/26093#issuecomment-705994388 conntrack-tools runc bash From 4cf4acae57e3be36f86d3f69b9a1e98e68793863 Mon Sep 17 00:00:00 2001 From: Morgan Jones Date: Fri, 16 May 2025 21:40:52 -0700 Subject: [PATCH 3/3] k3s: #405952: fix mount regression Until #405952 is fixed, we can use our own util-linux to avoid breaking k3s in the release. Revert this commit when that happens. --- .../networking/cluster/k3s/builder.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/cluster/k3s/builder.nix b/pkgs/applications/networking/cluster/k3s/builder.nix index 5e23e64a3cbc..e31d6203bc5f 100644 --- a/pkgs/applications/networking/cluster/k3s/builder.nix +++ b/pkgs/applications/networking/cluster/k3s/builder.nix @@ -41,6 +41,7 @@ lib: ethtool, fetchFromGitHub, fetchgit, + fetchpatch, fetchurl, fetchzip, findutils, @@ -331,6 +332,17 @@ let ldflags = versionldflags; }).overrideAttrs overrideContainerdAttrs; + + # TODO (#405952): remove this patch. We had to add it to avoid a mass rebuild + # for the 25.05 release. Once the above PR is merged, switch back to plain util-linuxMinimal. + k3sUtilLinux = util-linuxMinimal.overrideAttrs (prev: { + patches = + prev.patches or [ ] + ++ lib.singleton (fetchpatch { + url = "https://github.com/util-linux/util-linux/pull/3479.patch"; + hash = "sha256-bJqpZiPli5Pm/XpDA445Ab5jesXrlcnaO6e4V0B3rSw="; + }); + }); in buildGoModule rec { pname = "k3s"; @@ -377,7 +389,7 @@ buildGoModule rec { ipset bridge-utils ethtool - util-linuxMinimal # kubelet wants 'nsenter' and 'mount' from util-linux: https://github.com/kubernetes/kubernetes/issues/26093#issuecomment-705994388 + k3sUtilLinux # kubelet wants 'nsenter' and 'mount' from util-linux: https://github.com/kubernetes/kubernetes/issues/26093#issuecomment-705994388 conntrack-tools runc bash