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

57 lines
1.4 KiB
Nix
Raw Normal View History

2020-12-13 12:22:45 +00:00
{ lib
, buildGoModule
, fetchFromGitHub
, makeWrapper
, buildkit
, cni-plugins
, extraPackages ? [ ]
2020-12-13 12:22:45 +00:00
}:
buildGoModule rec {
pname = "nerdctl";
version = "0.6.0";
2020-12-13 12:22:45 +00:00
src = fetchFromGitHub {
owner = "AkihiroSuda";
repo = pname;
rev = "v${version}";
2021-01-19 10:48:00 +00:00
sha256 = "sha256-lSvYiTh67gK9kJls7VsayV8T3H6RzFEEKe49BOWnUBw=";
2020-12-13 12:22:45 +00:00
};
2021-01-19 10:48:00 +00:00
vendorSha256 = "sha256-qywiaNoO3pI7sfyPbwWR8BLd86RvJ2xSWwCJUsm3RkM=";
2020-12-13 12:22:45 +00:00
nativeBuildInputs = [ makeWrapper ];
buildFlagsArray = [
"-ldflags="
"-w"
"-s"
"-X github.com/AkihiroSuda/nerdctl/pkg/version.Version=v${version}"
"-X github.com/AkihiroSuda/nerdctl/pkg/version.Revision=<unknown>"
];
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"
'';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/nerdctl --help
# --version will error without containerd.sock access
$out/bin/nerdctl --help | grep "${version}"
runHook postInstallCheck
'';
2020-12-13 12:22:45 +00:00
meta = with lib; {
homepage = "https://github.com/AkihiroSuda/nerdctl/";
changelog = "https://github.com/AkihiroSuda/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
};
}