blob: 70332abbe6ef0e4c39bde5cc3cbc6cda0899188d (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
{ lib
, kernel
, stdenv
, clang-tools
, llvmPackages
, elfutils
, flex
, bison
, bc
, opensnitch
}:
stdenv.mkDerivation rec {
pname = "opensnitch_ebpf";
version = "${opensnitch.version}-${kernel.version}";
inherit (opensnitch) src;
sourceRoot = "source/ebpf_prog";
nativeBuildInputs = with llvmPackages; [
bc
bison
clang
clang-tools
elfutils
flex
libllvm
];
# We set -fno-stack-protector here to work around a clang regression.
# This is fine - bpf programs do not use stack protectors
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=opensnitch-ebpf-module&id=984b952a784eb701f691dd9f2d45dfeb8d15053b
env.NIX_CFLAGS_COMPILE = "-fno-stack-protector";
env.KERNEL_DIR="${kernel.dev}/lib/modules/${kernel.modDirVersion}/source";
env.KERNEL_HEADERS="${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
extraConfig =''
CONFIG_UPROBE_EVENTS=y
'';
installPhase = ''
runHook preInstall
for file in opensnitch*.o; do
install -Dm644 "$file" "$out/etc/opensnitchd/$file"
done
runHook postInstall
'';
meta = with lib; {
description = "eBPF process monitor module for OpenSnitch";
homepage = "https://github.com/evilsocket/opensnitch";
license = licenses.gpl3Only;
maintainers = with maintainers; [ onny ];
platforms = platforms.linux;
};
}
|