nerdctl: 1.7.7 -> 2.2.0, modernize, add update script

* Prefer `versionCheckHook`
* Prefer `finalAttrs` over `rec`

Diff: https://github.com/containerd/nerdctl/compare/v1.7.7...v2.2.0
Co-authored-by: 06kellyjac <dev@j-k.io>
Co-authored-by: Sandro Jäckel <sandro.jaeckel@gmail.com>
Co-authored-by: j-k <dev@j-k.io>
This commit is contained in:
Kenichi Kamiya
2025-12-13 21:34:09 +01:00
committed by Sandro Jäckel
co-authored by 06kellyjac Sandro Jäckel
parent 5311c75bbf
commit 37d19665d7
+27 -15
View File
@@ -6,38 +6,45 @@
installShellFiles,
buildkit,
cni-plugins,
writableTmpDirAsHomeHook,
versionCheckHook,
extraPackages ? [ ],
nix-update-script,
}:
buildGoModule rec {
buildGoModule (finalAttrs: {
pname = "nerdctl";
version = "1.7.7";
version = "2.2.0";
src = fetchFromGitHub {
owner = "containerd";
repo = "nerdctl";
rev = "v${version}";
hash = "sha256-GHFs8QvLcXu+DZ851TCLI7EVc9wMS5fRC4TYBXzyv3Q=";
tag = "v${finalAttrs.version}";
hash = "sha256-M3np4NfzEfMt4ii7Fdbdt+y1K7lSTWrqA9Bl+zpzxog=";
};
vendorHash = "sha256-5LRsT04T/CKv+YHaiM2g6giimWWXyzPju3iZuj2DfAY=";
vendorHash = "sha256-cnusyughQitdvYhHtuvCGS9/LdI/ku7DETBdAWttKsY=";
nativeBuildInputs = [
makeWrapper
installShellFiles
writableTmpDirAsHomeHook
];
ldflags =
let
t = "github.com/containerd/nerdctl/pkg/version";
t = "github.com/containerd/nerdctl/v${lib.versions.major finalAttrs.version}/pkg/version";
in
[
"-s"
"-w"
"-X ${t}.Version=v${version}"
"-X ${t}.Version=v${finalAttrs.version}"
"-X ${t}.Revision=<unknown>"
];
# testing framework which we don't need and can't be build as it is an extra go application
excludedPackages = [ "mod/tigron" ];
# Many checks require a containerd socket and running nerdctl after it's built
doCheck = false;
@@ -53,16 +60,21 @@ buildGoModule rec {
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/nerdctl --help
$out/bin/nerdctl --version | grep "nerdctl version ${version}"
runHook postInstallCheck
'';
nativeInstallCheckInputs = [
writableTmpDirAsHomeHook
versionCheckHook
];
versionCheckKeepEnvironment = [ "HOME" ];
passthru = {
updateScript = nix-update-script {
extraArgs = [ "--version-regex=^v([0-9.]+)$" ];
};
};
meta = {
homepage = "https://github.com/containerd/nerdctl/";
changelog = "https://github.com/containerd/nerdctl/releases/tag/v${version}";
changelog = "https://github.com/containerd/nerdctl/releases/tag/v${finalAttrs.version}";
description = "Docker-compatible CLI for containerd";
mainProgram = "nerdctl";
license = lib.licenses.asl20;
@@ -72,4 +84,4 @@ buildGoModule rec {
];
platforms = lib.platforms.linux;
};
}
})