# Pastebin 0u7Jvn3D { stdenv, lib, fetchurl, pkgs , linuxHeaders ? null , useBSDCompatHeaders ? true }: let prebuilt_crt = fetchurl { url = "https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/+archive/refs/heads/android11-release/lib/gcc/aarch64-linux-android/4.9.x.tar.gz"; sha256 = "1111111fq0f20rzbkhc38v74nqcsh9n3f343bpczqq8b1rz6vfrh"; }; prebuilt_libs = fetchurl { url = "https://android.googlesource.com/platform/prebuilts/ndk/+archive/refs/heads/ndk-release-r22/platform/platforms/android-29/arch-arm64/usr/lib.tar.gz"; sha256 = "1111111fq0f20rzbkhc38v74nqcsh9n3f343bpczqq8b1rz6vfrh"; }; kernelHeaders = pkgs.makeLinuxHeaders { arch = "aarch64"; version = "5.1"; src = fetchurl { url = "https://android.googlesource.com/kernel/msm/+archive/db4bfbca77cf68e60e503f84074b853934bce55f.tar.gz"; sha256 = "0ki5gh1nsigjdpfpyw9ckbsrska3m94hdq1cxngmwif5rhv1z8vi"; }; }; in stdenv.mkDerivation rec { pname = "bionic-prebuilt"; version = "android11-release"; src = fetchurl { url = "https://android.googlesource.com/platform/bionic/+archive/refs/heads/${version}.tar.gz"; sha256 = "1111111fq0f20rzbkhc38v74nqcsh9n3f343bpczqq8b1rz6vfrh"; }; NIX_DONT_SET_RPATH = true; dontPatch = true; dontConfigure = true; dontBuild = true; installPhase= '' # copy the bionic headers cp -r $src/include $out/ # copy the kernel headers cp -r ${kernelHeaders.out}/* $out/include/ mkdir $out/lib cp ${prebuilt_crt}/*.o $out/lib/ cp ${prebuilt_crt}/*.a $out/lib/ for i in libc.so libm.so libdl.so; do cp ${prebuilt_libs}/$i $out/lib/ done ''; passthru.linuxHeaders = kernelHeaders; meta = with lib; { description = "The Android libc implementation"; homepage = "https://android.googlesource.com/platform/bionic/"; license = licenses.mit; platforms = platforms.linux; maintainers = with maintainers; [ s1341 ]; }; }