3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/networking/cluster/nerdctl/default.nix

58 lines
1.5 KiB
Nix
Raw Normal View History

2020-12-13 12:22:45 +00:00
{ lib
, buildGoModule
, fetchFromGitHub
, makeWrapper
, installShellFiles
2020-12-13 12:22:45 +00:00
, buildkit
, cni-plugins
, extraPackages ? [ ]
2020-12-13 12:22:45 +00:00
}:
buildGoModule rec {
pname = "nerdctl";
2021-10-13 17:04:26 +01:00
version = "0.12.1";
2020-12-13 12:22:45 +00:00
src = fetchFromGitHub {
owner = "containerd";
2020-12-13 12:22:45 +00:00
repo = pname;
rev = "v${version}";
2021-10-13 17:04:26 +01:00
sha256 = "sha256-FRu1h6DT43rPaa9dcgz83w9K+xtzJgB4l/eTu+Fbb+c=";
2020-12-13 12:22:45 +00:00
};
2021-10-13 17:04:26 +01:00
vendorSha256 = "sha256-QFACe1/5MVbXKTknEyqjWclEQgJSZAJ/QljhLq/tWe4=";
2020-12-13 12:22:45 +00:00
nativeBuildInputs = [ makeWrapper installShellFiles ];
2020-12-13 12:22:45 +00:00
2021-07-02 08:12:14 +01:00
ldflags = let t = "github.com/containerd/nerdctl/pkg/version"; in
[ "-s" "-w" "-X ${t}.Version=v${version}" "-X ${t}.Revision=<unknown>" ];
2020-12-13 12:22:45 +00:00
2021-02-22 13:18:59 +00:00
# Many checks require a containerd socket and running nerdctl after it's built
doCheck = false;
2020-12-13 12:22:45 +00:00
postInstall = ''
wrapProgram $out/bin/nerdctl \
--prefix PATH : "${lib.makeBinPath ([ buildkit ] ++ extraPackages)}" \
2020-12-13 12:22:45 +00:00
--prefix CNI_PATH : "${cni-plugins}/bin"
installShellCompletion --cmd nerdctl \
--bash <($out/bin/nerdctl completion bash)
2020-12-13 12:22:45 +00:00
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/nerdctl --help
$out/bin/nerdctl --version | grep "nerdctl version ${version}"
runHook postInstallCheck
'';
2020-12-13 12:22:45 +00:00
meta = with lib; {
homepage = "https://github.com/containerd/nerdctl/";
changelog = "https://github.com/containerd/nerdctl/releases/tag/v${version}";
2020-12-13 12:22:45 +00:00
description = "A Docker-compatible CLI for containerd";
license = licenses.asl20;
maintainers = with maintainers; [ jk ];
platforms = platforms.linux;
2020-12-13 12:22:45 +00:00
};
}