blob: 39e145b1d5fe041d076647a4e302997f18eb82cd (
plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
{
fetchFromGitHub,
elfutils,
pkg-config,
stdenv,
zlib,
lib,
# for passthru.tests
knot-dns,
nixosTests,
systemd,
tracee,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libbpf";
version = "1.7.0";
src = fetchFromGitHub {
owner = "libbpf";
repo = "libbpf";
rev = "v${finalAttrs.version}";
hash = "sha256-F92msxkYp4yZA3qUoSwS5GKUhcEO6DrYNln7w6U+jt0=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [
elfutils
zlib
];
enableParallelBuilding = true;
makeFlags = [
"PREFIX=$(out)"
"--directory=src"
];
passthru.tests = {
inherit knot-dns tracee;
bpf = nixosTests.bpf;
systemd = systemd.override { withLibBPF = true; };
};
postInstall = ''
# install linux's libbpf-compatible linux/btf.h
install -Dm444 include/uapi/linux/*.h -t $out/include/linux
'';
# FIXME: Multi-output requires some fixes to the way the pkg-config file is
# constructed (it gets put in $out instead of $dev for some reason, with
# improper paths embedded). Don't enable it for now.
# outputs = [ "out" "dev" ];
__structuredAttrs = true;
meta = {
description = "Library for loading eBPF programs and reading and manipulating eBPF objects from user-space";
homepage = "https://github.com/libbpf/libbpf";
license = with lib.licenses; [
lgpl21 # or
bsd2
];
maintainers = with lib.maintainers; [
thoughtpolice
vcunat
saschagrunert
martinetd
];
platforms = lib.platforms.linux;
identifiers.cpeParts = lib.meta.cpeFullVersionWithVendor "libbpf_project" finalAttrs.version;
};
})
|