1{ lib
2, fetchFromGitHub
3, buildGoModule
4, btrfs-progs
5, go-md2man
6, installShellFiles
7, util-linux
8, nixosTests
9, kubernetes
10}:
11
12buildGoModule rec {
13 pname = "containerd";
14 version = "1.7.9";
15
16 src = fetchFromGitHub {
17 owner = "containerd";
18 repo = "containerd";
19 rev = "v${version}";
20 hash = "sha256-/kCnzOL8CJuJJglHzmev3alt8cMwTUbIiZhNft9zwps=";
21 };
22
23 vendorHash = null;
24
25 nativeBuildInputs = [ go-md2man installShellFiles util-linux ];
26
27 buildInputs = [ btrfs-progs ];
28
29 BUILDTAGS = lib.optionals (btrfs-progs == null) [ "no_btrfs" ];
30
31 buildPhase = ''
32 runHook preBuild
33 patchShebangs .
34 make binaries "VERSION=v${version}" "REVISION=${src.rev}"
35 runHook postBuild
36 '';
37
38 installPhase = ''
39 runHook preInstall
40 install -Dm555 bin/* -t $out/bin
41 installShellCompletion --bash contrib/autocomplete/ctr
42 installShellCompletion --zsh --name _ctr contrib/autocomplete/zsh_autocomplete
43 runHook postInstall
44 '';
45
46 passthru.tests = { inherit (nixosTests) docker; } // kubernetes.tests;
47
48 meta = with lib; {
49 changelog = "https://github.com/containerd/containerd/releases/tag/${src.rev}";
50 homepage = "https://containerd.io/";
51 description = "A daemon to control runC";
52 license = licenses.asl20;
53 maintainers = with maintainers; [ offline vdemeester endocrimes ];
54 platforms = platforms.linux;
55 };
56}