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