1{
2 lib,
3 btrfs-progs,
4 buildGoModule,
5 fetchFromGitHub,
6 glibc,
7 gpgme,
8 installShellFiles,
9 libapparmor,
10 libseccomp,
11 libselinux,
12 lvm2,
13 pkg-config,
14 nixosTests,
15 go-md2man,
16}:
17
18buildGoModule rec {
19 pname = "cri-o";
20 version = "1.33.2";
21
22 src = fetchFromGitHub {
23 owner = "cri-o";
24 repo = "cri-o";
25 rev = "v${version}";
26 hash = "sha256-QHWE0BVsGFk1UOo51wZUl24bisS9GzCeWkE7yM3dYec=";
27 };
28 vendorHash = null;
29
30 doCheck = false;
31
32 outputs = [
33 "out"
34 "man"
35 ];
36 nativeBuildInputs = [
37 installShellFiles
38 go-md2man
39 pkg-config
40 ];
41
42 buildInputs = [
43 btrfs-progs
44 gpgme
45 libapparmor
46 libseccomp
47 libselinux
48 lvm2
49 ]
50 ++ lib.optionals (glibc != null) [
51 glibc
52 glibc.static
53 ];
54
55 BUILDTAGS = "apparmor seccomp selinux containers_image_openpgp containers_image_ostree_stub";
56 buildPhase = ''
57 runHook preBuild
58 sed -i 's;\thack/;\tbash ./hack/;g' Makefile
59 make binaries docs BUILDTAGS="$BUILDTAGS"
60 runHook postBuild
61 '';
62
63 installPhase = ''
64 runHook preInstall
65 install -Dm755 bin/* -t $out/bin
66
67 for shell in bash fish zsh; do
68 installShellCompletion --$shell completions/$shell/*
69 done
70
71 install contrib/cni/*.conflist -Dt $out/etc/cni/net.d
72 install crictl.yaml -Dt $out/etc
73
74 installManPage docs/*.[1-9]
75 runHook postInstall
76 '';
77
78 passthru.tests = { inherit (nixosTests) cri-o; };
79
80 meta = with lib; {
81 homepage = "https://cri-o.io";
82 description = ''
83 Open Container Initiative-based implementation of the
84 Kubernetes Container Runtime Interface
85 '';
86 license = licenses.asl20;
87 teams = [ teams.podman ];
88 platforms = platforms.linux;
89 };
90}