1{ stdenv, lib, fetchFromGitHub, removeReferencesTo
2, go, libapparmor, apparmor-parser, libseccomp, btrfs-progs }:
3
4with lib;
5
6stdenv.mkDerivation rec {
7 name = "containerd-${version}";
8 version = "1.0.2";
9
10 src = fetchFromGitHub {
11 owner = "containerd";
12 repo = "containerd";
13 rev = "v${version}";
14 sha256 = "1x6mmk69jksh4m9rjd8qwpp0qc7jmimpkq9pw9237p0v63p9yci0";
15 };
16
17 hardeningDisable = [ "fortify" ];
18
19 buildInputs = [ removeReferencesTo go btrfs-progs ];
20 buildFlags = "VERSION=v${version}";
21
22 BUILDTAGS = []
23 ++ optional (btrfs-progs == null) "no_btrfs";
24
25 preConfigure = ''
26 # Extract the source
27 cd "$NIX_BUILD_TOP"
28 mkdir -p "go/src/github.com/containerd"
29 mv "$sourceRoot" "go/src/github.com/containerd/containerd"
30 export GOPATH=$NIX_BUILD_TOP/go:$GOPATH
31'';
32
33 preBuild = ''
34 cd go/src/github.com/containerd/containerd
35 patchShebangs .
36 '';
37
38 installPhase = ''
39 mkdir -p $out/bin
40 cp bin/* $out/bin
41 '';
42
43 preFixup = ''
44 find $out -type f -exec remove-references-to -t ${go} '{}' +
45 '';
46
47 meta = {
48 homepage = https://containerd.tools/;
49 description = "A daemon to control runC";
50 license = licenses.asl20;
51 maintainers = with maintainers; [ offline ];
52 platforms = platforms.linux;
53 };
54}