k3s: replace `systemd` with `systemdMinimal` (#441287)

Changed files
+23 -25
pkgs
applications
networking
cluster
+23 -25
pkgs/applications/networking/cluster/k3s/builder.nix
···
ethtool,
fetchFromGitHub,
fetchgit,
-
fetchpatch,
fetchurl,
fetchzip,
findutils,
···
kmod,
lib,
libseccomp,
-
makeWrapper,
+
makeBinaryWrapper,
nixosTests,
overrideBundleAttrs ? { }, # An attrSet/function to override the `k3sBundle` derivation.
overrideCniPluginsAttrs ? { }, # An attrSet/function to override the `k3sCNIPlugins` derivation.
···
socat,
sqlite,
stdenv,
-
systemd,
+
systemdMinimal,
util-linuxMinimal,
yq-go,
zstd,
+
versionCheckHook,
}:
# k3s is a kinda weird derivation. One of the main points of k3s is the
···
}).overrideAttrs
overrideContainerdAttrs;
in
-
buildGoModule rec {
+
buildGoModule (finalAttrs: {
pname = "k3s";
version = k3sVersion;
pos = builtins.unsafeGetAttrPos "k3sVersion" attrs;
···
# Nix prefers dynamically linked binaries over static binary.
substituteInPlace scripts/package-cli \
-
--replace '"$LDFLAGS $STATIC" -o' \
-
'"$LDFLAGS" -o' \
-
--replace "STATIC=\"-extldflags \'-static\'\"" \
-
""
+
--replace-fail '"$LDFLAGS $STATIC" -o' \
+
'"$LDFLAGS" -o'
# Upstream codegen fails with trimpath set. Removes "trimpath" for 'go generate':
substituteInPlace scripts/package-cli \
-
--replace '"''${GO}" generate' \
+
--replace-fail '"''${GO}" generate' \
'GOFLAGS="" \
GOOS="${pkgsBuildBuild.go.GOOS}" \
GOARCH="${pkgsBuildBuild.go.GOARCH}" \
···
k3sKillallDeps = [
bash
-
systemd
+
systemdMinimal
procps
coreutils
gnugrep
···
gnused
];
-
buildInputs = k3sRuntimeDeps;
+
buildInputs = finalAttrs.k3sRuntimeDeps;
nativeBuildInputs = [
-
makeWrapper
+
makeBinaryWrapper
rsync
yq-go
zstd
···
# wildcard to match the arm64 build too
install -m 0755 dist/artifacts/k3s* -D $out/bin/k3s
wrapProgram $out/bin/k3s \
-
--prefix PATH : ${lib.makeBinPath k3sRuntimeDeps} \
+
--prefix PATH : ${lib.makeBinPath finalAttrs.k3sRuntimeDeps} \
--prefix PATH : "$out/bin"
ln -s $out/bin/k3s $out/bin/kubectl
ln -s $out/bin/k3s $out/bin/crictl
ln -s $out/bin/k3s $out/bin/ctr
install -m 0755 ${k3sKillallSh} -D $out/bin/k3s-killall.sh
wrapProgram $out/bin/k3s-killall.sh \
-
--prefix PATH : ${lib.makeBinPath (k3sRuntimeDeps ++ k3sKillallDeps)}
+
--prefix PATH : ${lib.makeBinPath (finalAttrs.k3sRuntimeDeps ++ finalAttrs.k3sKillallDeps)}
runHook postInstall
'';
doInstallCheck = true;
-
installCheckPhase = ''
-
runHook preInstallCheck
-
$out/bin/k3s --version | grep -F "v${k3sVersion}" >/dev/null
-
runHook postInstallCheck
-
'';
+
nativeInstallCheckInputs = [ versionCheckHook ];
+
versionCheckProgramArg = "--version";
passthru = {
inherit airgap-images;
···
k3sRepo = k3sRepo;
k3sRoot = k3sRoot;
k3sBundle = k3sBundle;
-
mkTests =
-
version:
+
tests =
let
-
k3s_version = "k3s_" + lib.replaceStrings [ "." ] [ "_" ] (lib.versions.majorMinor version);
+
mkTests =
+
version:
+
let
+
k3s_version = "k3s_" + lib.replaceStrings [ "." ] [ "_" ] (lib.versions.majorMinor version);
+
in
+
lib.mapAttrs (name: value: nixosTests.k3s.${name}.${k3s_version}) nixosTests.k3s;
in
-
lib.mapAttrs (name: value: nixosTests.k3s.${name}.${k3s_version}) nixosTests.k3s;
-
tests = passthru.mkTests k3sVersion;
+
mkTests k3sVersion;
updateScript = updateScript;
imagesList = throw "k3s.imagesList was removed";
airgapImages = throw "k3s.airgapImages was renamed to k3s.airgap-images";
···
// (lib.mapAttrs (_: value: fetchurl value) imagesVersions);
meta = baseMeta;
-
}
+
})