89 lines
2.1 KiB
Nix
89 lines
2.1 KiB
Nix
{
|
|
lib,
|
|
buildGoModule,
|
|
fetchFromGitHub,
|
|
makeWrapper,
|
|
installShellFiles,
|
|
buildkit,
|
|
cni-plugins,
|
|
writableTmpDirAsHomeHook,
|
|
versionCheckHook,
|
|
extraPackages ? [ ],
|
|
nix-update-script,
|
|
}:
|
|
|
|
buildGoModule (finalAttrs: {
|
|
pname = "nerdctl";
|
|
version = "2.3.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "containerd";
|
|
repo = "nerdctl";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-4t6yyoFnYm5rGNw8SG1nfy5C0+nks/9G8pzhuZ4U0ag=";
|
|
};
|
|
|
|
vendorHash = "sha256-hjqtwOph1grdmR2kHIbBVCxuNxNnUHPH8RJSCXo0rvU=";
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
installShellFiles
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
|
|
ldflags =
|
|
let
|
|
t = "github.com/containerd/nerdctl/v${lib.versions.major finalAttrs.version}/pkg/version";
|
|
in
|
|
[
|
|
"-s"
|
|
"-w"
|
|
"-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;
|
|
|
|
postInstall = ''
|
|
wrapProgram $out/bin/nerdctl \
|
|
--prefix PATH : "${lib.makeBinPath ([ buildkit ] ++ extraPackages)}" \
|
|
--prefix CNI_PATH : "${cni-plugins}/bin"
|
|
|
|
installShellCompletion --cmd nerdctl \
|
|
--bash <($out/bin/nerdctl completion bash) \
|
|
--fish <($out/bin/nerdctl completion fish) \
|
|
--zsh <($out/bin/nerdctl completion zsh)
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
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${finalAttrs.version}";
|
|
description = "Docker-compatible CLI for containerd";
|
|
mainProgram = "nerdctl";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [
|
|
developer-guy
|
|
jk
|
|
miniharinn
|
|
];
|
|
platforms = lib.platforms.linux;
|
|
};
|
|
})
|