Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 pkgsCross,
5 btrfs-progs,
6 buildGoModule,
7 fetchFromGitHub,
8 go-md2man,
9 kubernetes,
10 nix-update-script,
11 nixosTests,
12 util-linux,
13 btrfsSupport ? btrfs-progs != null,
14 withMan ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
15}:
16
17buildGoModule rec {
18 pname = "containerd";
19 version = "2.1.3";
20
21 outputs = [
22 "out"
23 "doc"
24 ]
25 ++ lib.optional withMan "man";
26
27 src = fetchFromGitHub {
28 owner = "containerd";
29 repo = "containerd";
30 tag = "v${version}";
31 hash = "sha256-MqHcwomsVYbjziO0vIpGAcREChe5mbJVGsvM96bszLA=";
32 };
33
34 postPatch = "patchShebangs .";
35
36 vendorHash = null;
37
38 strictDeps = true;
39
40 nativeBuildInputs = [
41 util-linux
42 ]
43 ++ lib.optional withMan go-md2man;
44
45 buildInputs = lib.optional btrfsSupport btrfs-progs;
46
47 tags = lib.optional (!btrfsSupport) "no_btrfs";
48
49 makeFlags = [
50 "PREFIX=${placeholder "out"}"
51
52 "BUILDTAGS=${toString tags}"
53 "REVISION=${src.rev}"
54 "VERSION=v${version}"
55 ];
56
57 installTargets = [
58 "install"
59 "install-doc"
60 ]
61 ++ lib.optional withMan "install-man";
62
63 buildPhase = ''
64 runHook preBuild
65 make $makeFlags
66 runHook postBuild
67 '';
68
69 installPhase = ''
70 runHook preInstall
71 make $makeFlags $installTargets
72 runHook postInstall
73 '';
74
75 passthru = {
76 tests = lib.optionalAttrs stdenv.hostPlatform.isLinux (
77 {
78 cross =
79 let
80 systemString = if stdenv.buildPlatform.isAarch64 then "gnu64" else "aarch64-multiplatform";
81 in
82 pkgsCross.${systemString}.containerd;
83
84 inherit (nixosTests) docker;
85 }
86 // kubernetes.tests
87 );
88
89 updateScript = nix-update-script { };
90 };
91
92 meta = {
93 description = "Daemon to control runC";
94 homepage = "https://containerd.io/";
95 changelog = "https://github.com/containerd/containerd/releases/tag/v${version}";
96 license = lib.licenses.asl20;
97 maintainers = with lib.maintainers; [
98 offline
99 vdemeester
100 getchoo
101 ];
102 mainProgram = "containerd";
103 platforms = lib.platforms.linux;
104 };
105}