nixpkgs/pkgs/by-name/ne/nerdctl/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.7 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";
2024-09-10 14:06:31 +00:00
version = "1.7.7";
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}";
2024-09-10 14:06:31 +00:00
hash = "sha256-GHFs8QvLcXu+DZ851TCLI7EVc9wMS5fRC4TYBXzyv3Q=";
2020-12-13 12:22:45 +00:00
};
2024-09-10 14:06:31 +00:00
vendorHash = "sha256-5LRsT04T/CKv+YHaiM2g6giimWWXyzPju3iZuj2DfAY=";
2020-12-13 12:22:45 +00:00
nativeBuildInputs = [ makeWrapper installShellFiles ];
2020-12-13 12:22:45 +00:00
2021-07-02 07:12:14 +00: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 \
2021-11-05 11:55:34 +00:00
--bash <($out/bin/nerdctl completion bash) \
--fish <($out/bin/nerdctl completion fish) \
--zsh <($out/bin/nerdctl completion zsh)
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
'';
2024-04-30 16:22:27 +00:00
meta = {
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 = "Docker-compatible CLI for containerd";
mainProgram = "nerdctl";
2024-04-30 16:22:27 +00:00
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ developer-guy jk ];
platforms = lib.platforms.linux;
2020-12-13 12:22:45 +00:00
};
}