git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #114821 from erosennin/catatonit

catatonit: init at 0.1.5, fix podman --init

commit04a37553f2fcd6f2f513b8e81b7e8e20ebf62d2b authoradisbladis <adisbladis@gmail.com> dateMon 22 Mar 2021, 16:04 (6 years ago) parent2af47fc5a25135
4 files changed+52−1
nixos/modules/virtualisation/containers.nix+2−1 nixos/tests/podman.nix+9 pkgs/applications/virtualization/catatonit/default.nix+39 pkgs/top-level/all-packages.nix+2
nixos/modules/virtualisation/containers.nix+2−1
@@ -118,8 +118,9 @@ in
118118 [network]
119119 cni_plugin_dirs = ["${pkgs.cni-plugins}/bin/"]
120120
121− ${lib.optionalString (cfg.ociSeccompBpfHook.enable == true) ''
122121 [engine]
122+ init_path = "${pkgs.catatonit}/bin/catatonit"
123+ ${lib.optionalString (cfg.ociSeccompBpfHook.enable) ''
123124 hooks_dir = [
124125 "${config.boot.kernelPackages.oci-seccomp-bpf-hook}",
125126 ]
nixos/tests/podman.nix+9
@@ -96,6 +96,15 @@ import ./make-test-python.nix (
9696 podman.succeed(su_cmd("podman ps | grep sleeping"))
9797 podman.succeed(su_cmd("podman stop sleeping"))
9898 podman.succeed(su_cmd("podman rm sleeping"))
99+
100+ with subtest("Run container with init"):
101+ podman.succeed(
102+ "tar cv -C ${pkgs.pkgsStatic.busybox} . | podman import - busybox"
103+ )
104+ pid = podman.succeed("podman run --rm busybox readlink /proc/self").strip()
105+ assert pid == "1"
106+ pid = podman.succeed("podman run --rm --init busybox readlink /proc/self").strip()
107+ assert pid == "2"
99108 '';
100109 }
101110)
pkgs/applications/virtualization/catatonit/default.nixnew file+39
@@ -0,0 +1,39 @@
1+{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, glibc, nixosTests }:
2+
3+stdenv.mkDerivation rec {
4+ pname = "catatonit";
5+ version = "0.1.5";
6+
7+ src = fetchFromGitHub {
8+ owner = "openSUSE";
9+ repo = pname;
10+ rev = "v${version}";
11+ sha256 = "ciJ1MI7jr5P2PgxIykQ+BiwNUO8lQHGt0+U8CNbc5bI=";
12+ };
13+
14+ patches = [
15+ # Fix compilation with musl
16+ (fetchpatch {
17+ url = "https://github.com/openSUSE/catatonit/commit/75014b1c3099245b7d0f44f24d7f6dc4888a45fd.patch";
18+ sha256 = "sha256-9VMNUT1U90ocjvE7EXYfLxuodDwTXXHYg89qqa5Jq0g=";
19+ })
20+ ];
21+
22+ nativeBuildInputs = [ autoreconfHook ];
23+ buildInputs = lib.optionals (!stdenv.hostPlatform.isMusl) [ glibc glibc.static ];
24+
25+ doInstallCheck = true;
26+ installCheckPhase = ''
27+ readelf -d $out/bin/catatonit | grep 'There is no dynamic section in this file.'
28+ '';
29+
30+ passthru.tests = { inherit (nixosTests) podman; };
31+
32+ meta = with lib; {
33+ description = "A container init that is so simple it's effectively brain-dead";
34+ homepage = "https://github.com/openSUSE/catatonit";
35+ license = licenses.gpl3Plus;
36+ maintainers = with maintainers; [ erosennin ] ++ teams.podman.members;
37+ platforms = platforms.linux;
38+ };
39+}
pkgs/top-level/all-packages.nix+2
@@ -197,6 +197,8 @@ in
197197 inherit (python3Packages) sphinx;
198198 };
199199
200+ catatonit = callPackage ../applications/virtualization/catatonit { };
201+
200202 cen64 = callPackage ../misc/emulators/cen64 { };
201203
202204 cereal = callPackage ../development/libraries/cereal { };