summary refs log tree commit diff
path: root/pkgs/os-specific/linux/syscall_limiter/default.nix
blob: 0354abf46e1a618bd327dc698dbabdcd9a444755 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ stdenv
, fetchFromGitHub
, libseccomp
, perl
, which
}:

stdenv.mkDerivation {
  pname = "syscall_limiter";
  version = "2017-01-23";

  src = fetchFromGitHub {
    owner  = "vi";
    repo   = "syscall_limiter";
    rev    = "481c8c883f2e1260ebc83b352b63bf61a930a341";
    sha256 = "0z5arj1kq1xczgrbw1b8m9kicbv3vs9bd32wvgfr4r6ndingsp5m";
  };

  buildInputs = [ libseccomp ];

  installPhase = ''
    mkdir -p $out/bin
    cp -v limit_syscalls $out/bin
    cp -v monitor.sh $out/bin/limit_syscalls_monitor.sh
    substituteInPlace $out/bin/limit_syscalls_monitor.sh \
      --replace perl ${perl}/bin/perl \
      --replace which ${which}/bin/which
  '';

  meta = with stdenv.lib; {
    description = "Start Linux programs with only selected syscalls enabled";
    homepage    = "https://github.com/vi/syscall_limiter";
    license     = licenses.mit;
    maintainers = with maintainers; [ obadz ];
    platforms   = platforms.linux;
  };
}