about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/maintainers.nix1
-rw-r--r--pkgs/tools/system/minijail/default.nix39
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 42 insertions, 0 deletions
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 0baf98a0422c..70bbb2fc459c 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -488,6 +488,7 @@
   patternspandemic = "Brad Christensen <patternspandemic@live.com>";
   pawelpacana = "Paweł Pacana <pawel.pacana@gmail.com>";
   pbogdan = "Piotr Bogdan <ppbogdan@gmail.com>";
+  pcarrier = "Pierre Carrier <pc@rrier.ca>";
   periklis = "theopompos@gmail.com";
   pesterhazy = "Paulus Esterhazy <pesterhazy@gmail.com>";
   peterhoeg = "Peter Hoeg <peter@hoeg.com>";
diff --git a/pkgs/tools/system/minijail/default.nix b/pkgs/tools/system/minijail/default.nix
new file mode 100644
index 000000000000..c47d40cef2b2
--- /dev/null
+++ b/pkgs/tools/system/minijail/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchgit, libcap }:
+
+stdenv.mkDerivation rec {
+  shortname = "minijail";
+  name = "${shortname}-${version}";
+  version = "android-8.0.0_r34";
+
+  src = fetchgit {
+    url = "https://android.googlesource.com/platform/external/minijail";
+    rev = version;
+    sha256 = "1d0q08cgks6h6ffsw3zw8dz4rm9y2djj2pwwy3xi6flx7vwy0psf";
+  };
+
+  buildInputs = [ libcap ];
+
+  makeFlags = [ "LIBDIR=$(out)/lib" ];
+
+  preConfigure = ''
+    substituteInPlace common.mk --replace /bin/echo echo
+    sed -i '/#include <asm\/siginfo.h>/ d' signal_handler.c
+  '';
+
+  installPhase = ''
+    mkdir -p $out/lib
+    cp -v *.so $out/lib
+    mkdir -p $out/include
+    cp -v libminijail.h $out/include
+    mkdir -p $out/bin
+    cp minijail0 $out/bin
+  '';
+
+  meta = {
+    homepage = https://android.googlesource.com/platform/external/minijail/;
+    description = "Sandboxing library and application using Linux namespaces and capabilities";
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = with stdenv.lib.maintainers; [pcarrier];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index dc4098694cb0..dcb7c4e257e9 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3376,6 +3376,8 @@ with pkgs;
 
   miniball = callPackage ../development/libraries/miniball { };
 
+  minijail = callPackage ../tools/system/minijail { };
+
   minixml = callPackage ../development/libraries/minixml { };
 
   mir-qualia = callPackage ../tools/text/mir-qualia {