@@ -0,0 +1,37 @@
1+{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, glibc }:
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+ meta = with lib; {
31+ description = "A container init that is so simple it's effectively brain-dead";
32+ homepage = "https://github.com/openSUSE/catatonit";
33+ license = licenses.gpl3Plus;
34+ maintainers = with maintainers; [ erosennin ];
35+ platforms = platforms.linux;
36+ };
37+}