nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ fetchFromGitHub
2, fetchpatch
3, libelf
4, pkg-config
5, stdenv
6, zlib
7, lib
8, nixosTests
9}:
10
11stdenv.mkDerivation rec {
12 pname = "libbpf";
13 version = "0.7.0";
14
15 src = fetchFromGitHub {
16 owner = "libbpf";
17 repo = "libbpf";
18 rev = "v${version}";
19 sha256 = "sha256-NFVJ8JquWVzu+QoaaOMzhnu6/IqdP1FPhtJFidXA4L4=";
20 };
21
22 nativeBuildInputs = [ pkg-config ];
23 buildInputs = [ libelf zlib ];
24
25 enableParallelBuilding = true;
26 makeFlags = [ "PREFIX=$(out)" "-C src" ];
27
28 passthru.tests = {
29 bpf = nixosTests.bpf;
30 };
31
32 postInstall = ''
33 # install linux's libbpf-compatible linux/btf.h
34 install -Dm444 include/uapi/linux/*.h -t $out/include/linux
35 '';
36
37 # FIXME: Multi-output requires some fixes to the way the pkg-config file is
38 # constructed (it gets put in $out instead of $dev for some reason, with
39 # improper paths embedded). Don't enable it for now.
40
41 # outputs = [ "out" "dev" ];
42
43 meta = with lib; {
44 description = "Upstream mirror of libbpf";
45 homepage = "https://github.com/libbpf/libbpf";
46 license = with licenses; [ lgpl21 /* or */ bsd2 ];
47 maintainers = with maintainers; [ thoughtpolice vcunat saschagrunert martinetd ];
48 platforms = platforms.linux;
49 };
50}