about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/nsjail/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/nsjail/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/nsjail/default.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/nsjail/default.nix b/nixpkgs/pkgs/tools/security/nsjail/default.nix
new file mode 100644
index 000000000000..568113368a08
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/nsjail/default.nix
@@ -0,0 +1,43 @@
+{ lib, stdenv, fetchFromGitHub, autoconf, bison, flex, libtool, pkg-config, which
+, libnl, protobuf, protobufc, shadow
+}:
+
+stdenv.mkDerivation rec {
+  pname = "nsjail";
+  version = "3.0"; # Bumping? Remove the bison patch.
+
+  src = fetchFromGitHub {
+    owner           = "google";
+    repo            = "nsjail";
+    rev             = version;
+    fetchSubmodules = true;
+    sha256          = "1w6x8xcrs0i1y3q41gyq8z3cq9x24qablklc4jiydf855lhqn4dh";
+  };
+
+  nativeBuildInputs = [ autoconf bison flex libtool pkg-config which ];
+  buildInputs = [ libnl protobuf protobufc ];
+  enableParallelBuilding = true;
+
+  patches = [
+    # To remove after bumping 3.0
+    ./001-fix-bison-link-error.patch
+  ];
+
+  preBuild = ''
+    makeFlagsArray+=(USER_DEFINES='-DNEWUIDMAP_PATH=${shadow}/bin/newuidmap -DNEWGIDMAP_PATH=${shadow}/bin/newgidmap')
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin $out/share/man/man1
+    install nsjail $out/bin/
+    install nsjail.1 $out/share/man/man1/
+  '';
+
+  meta = with lib; {
+    description = "A light-weight process isolation tool, making use of Linux namespaces and seccomp-bpf syscall filters";
+    homepage    = "http://nsjail.com/";
+    license     = licenses.asl20;
+    maintainers = with maintainers; [ arturcygan bosu c0bw3b ];
+    platforms   = platforms.linux;
+  };
+}