1{ stdenv
2, lib
3, fetchFromGitHub
4, autoreconfHook
5, go-md2man
6, pkg-config
7, libcap
8, libseccomp
9, python3
10, systemd
11, yajl
12, nixosTests
13, criu
14}:
15
16let
17 # these tests require additional permissions
18 disabledTests = [
19 "test_capabilities.py"
20 "test_cwd.py"
21 "test_delete.py"
22 "test_detach.py"
23 "test_exec.py"
24 "test_hooks.py"
25 "test_hostname.py"
26 "test_oci_features"
27 "test_paths.py"
28 "test_pid.py"
29 "test_pid_file.py"
30 "test_preserve_fds.py"
31 "test_resources"
32 "test_seccomp"
33 "test_start.py"
34 "test_uid_gid.py"
35 "test_update.py"
36 "tests_libcrun_utils"
37 ];
38
39in
40stdenv.mkDerivation rec {
41 pname = "crun";
42 version = "1.11.1";
43
44 src = fetchFromGitHub {
45 owner = "containers";
46 repo = pname;
47 rev = version;
48 hash = "sha256-D4Y+n/6R2v3U/BhYQitsHd6ckda1vfAzciFbTM/1J80=";
49 fetchSubmodules = true;
50 };
51
52 nativeBuildInputs = [ autoreconfHook go-md2man pkg-config python3 ];
53
54 buildInputs = [ criu libcap libseccomp systemd yajl ];
55
56 enableParallelBuilding = true;
57 strictDeps = true;
58
59 NIX_LDFLAGS = "-lcriu";
60
61 # we need this before autoreconfHook does its thing in order to initialize
62 # config.h with the correct values
63 postPatch = ''
64 echo ${version} > .tarball-version
65 echo '#define GIT_VERSION "${src.rev}"' > git-version.h
66
67 ${lib.concatMapStringsSep "\n" (e:
68 "substituteInPlace Makefile.am --replace 'tests/${e}' ''"
69 ) disabledTests}
70 '';
71
72 doCheck = true;
73
74 passthru.tests = { inherit (nixosTests) podman; };
75
76 meta = with lib; {
77 changelog = "https://github.com/containers/crun/releases/tag/${version}";
78 description = "A fast and lightweight fully featured OCI runtime and C library for running containers";
79 homepage = "https://github.com/containers/crun";
80 license = licenses.gpl2Plus;
81 platforms = platforms.linux;
82 maintainers = with maintainers; [ ] ++ teams.podman.members;
83 };
84}