2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, autoconf, bison, flex, libtool, pkg-config, which
|
2022-09-22 12:36:57 +00:00
|
|
|
, libnl, protobuf, protobufc, shadow, installShellFiles
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "nsjail";
|
2023-10-19 13:55:26 +00:00
|
|
|
version = "3.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "nsjail";
|
|
|
|
rev = version;
|
|
|
|
fetchSubmodules = true;
|
2023-10-19 13:55:26 +00:00
|
|
|
hash = "sha256-/K+qJV5Dq+my45Cpw6czdsWLtO9lnJwZTsOIRt4Iijk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
nativeBuildInputs = [ autoconf bison flex installShellFiles libtool pkg-config which ];
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ libnl protobuf protobufc ];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error" ];
|
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
preBuild = ''
|
|
|
|
makeFlagsArray+=(USER_DEFINES='-DNEWUIDMAP_PATH=${shadow}/bin/newuidmap -DNEWGIDMAP_PATH=${shadow}/bin/newgidmap')
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
2022-12-17 10:02:37 +00:00
|
|
|
runHook preInstall
|
2022-09-22 12:36:57 +00:00
|
|
|
install -Dm755 nsjail "$out/bin/nsjail"
|
|
|
|
installManPage nsjail.1
|
2022-12-17 10:02:37 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Light-weight process isolation tool, making use of Linux namespaces and seccomp-bpf syscall filters";
|
2022-12-17 10:02:37 +00:00
|
|
|
homepage = "https://nsjail.dev/";
|
2023-10-19 13:55:26 +00:00
|
|
|
changelog = "https://github.com/google/nsjail/releases/tag/${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2020-08-20 17:08:02 +00:00
|
|
|
maintainers = with maintainers; [ arturcygan bosu c0bw3b ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "nsjail";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|