1{ lib
2, fetchFromGitHub
3, buildGoModule
4, go-md2man
5, installShellFiles
6, pkg-config
7, which
8, libapparmor
9, libseccomp
10, libselinux
11, makeWrapper
12, nixosTests
13}:
14
15buildGoModule rec {
16 pname = "runc";
17 version = "1.1.10";
18
19 src = fetchFromGitHub {
20 owner = "opencontainers";
21 repo = "runc";
22 rev = "v${version}";
23 hash = "sha256-YoRwr5imolblix1st/YeVTrAUdQXTqrx1BdNMdYlt/0=";
24 };
25
26 vendorHash = null;
27 outputs = [ "out" "man" ];
28
29 nativeBuildInputs = [ go-md2man installShellFiles makeWrapper pkg-config which ];
30
31 buildInputs = [ libselinux libseccomp libapparmor ];
32
33 makeFlags = [ "BUILDTAGS+=seccomp" ];
34
35 buildPhase = ''
36 runHook preBuild
37 patchShebangs .
38 make ${toString makeFlags} runc man
39 runHook postBuild
40 '';
41
42 installPhase = ''
43 runHook preInstall
44 install -Dm755 runc $out/bin/runc
45 installManPage man/*/*.[1-9]
46 wrapProgram $out/bin/runc \
47 --prefix PATH : /run/current-system/systemd/bin
48 runHook postInstall
49 '';
50
51 passthru.tests = { inherit (nixosTests) cri-o docker podman; };
52
53 meta = with lib; {
54 homepage = "https://github.com/opencontainers/runc";
55 description = "A CLI tool for spawning and running containers according to the OCI specification";
56 license = licenses.asl20;
57 maintainers = with maintainers; [ offline ] ++ teams.podman.members;
58 platforms = platforms.linux;
59 };
60}