It makes more sense to keep constants.json in the minijail package, because that's where the tool that consumes it, compile_seccomp_policy, lives. By having it in this package, we can set it as the default location for compile_seccomp_policy, which means it shouldn't ever even need to be specified on the command line (although it still can be). And we can hook into the cross-compilation machinery to get it to automatically use the constants for the right architecture. I've also changed from generating constants.json by running a test program in qemu-user to generating it from LLVM IR, which will save a huge QEMU build dependency.
45 lines
1.3 KiB
Nix
45 lines
1.3 KiB
Nix
{ stdenv, lib, fetchFromGitiles, libcap }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "minijail";
|
|
version = "18";
|
|
|
|
src = fetchFromGitiles {
|
|
url = "https://android.googlesource.com/platform/external/minijail";
|
|
rev = "linux-v${version}";
|
|
sha256 = "sha256-OpwzISZ5iZNQvJAX7UJJ4gELEaVfcQgY9cqMM0YvBzc=";
|
|
};
|
|
|
|
buildInputs = [ libcap ];
|
|
|
|
makeFlags = [ "ECHO=echo" "LIBDIR=$(out)/lib" ];
|
|
|
|
postPatch = ''
|
|
substituteInPlace Makefile --replace /bin/echo echo
|
|
patchShebangs platform2_preinstall.sh
|
|
'';
|
|
|
|
installPhase = ''
|
|
./platform2_preinstall.sh ${version} $out/include/chromeos
|
|
|
|
mkdir -p $out/lib/pkgconfig $out/include/chromeos $out/bin \
|
|
$out/share/minijail
|
|
|
|
cp -v *.so $out/lib
|
|
cp -v *.pc $out/lib/pkgconfig
|
|
cp -v libminijail.h scoped_minijail.h $out/include/chromeos
|
|
cp -v minijail0 $out/bin
|
|
'';
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
meta = with lib; {
|
|
homepage = "https://android.googlesource.com/platform/external/minijail/";
|
|
description = "Sandboxing library and application using Linux namespaces and capabilities";
|
|
changelog = "https://android.googlesource.com/platform/external/minijail/+/refs/tags/linux-v${version}";
|
|
license = licenses.bsd3;
|
|
maintainers = with maintainers; [ pcarrier qyliss ];
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|