Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 71 lines 1.5 kB view raw
1{ 2 fetchFromGitHub, 3 elfutils, 4 pkg-config, 5 stdenv, 6 zlib, 7 lib, 8 9 # for passthru.tests 10 knot-dns, 11 nixosTests, 12 systemd, 13 tracee, 14}: 15 16stdenv.mkDerivation rec { 17 pname = "libbpf"; 18 version = "1.5.1"; 19 20 src = fetchFromGitHub { 21 owner = "libbpf"; 22 repo = "libbpf"; 23 rev = "v${version}"; 24 hash = "sha256-bTT7ehTHVaqkT27hJrH2YQBrVU6uo2gkgHE1AJtDKKY="; 25 }; 26 27 nativeBuildInputs = [ pkg-config ]; 28 buildInputs = [ 29 elfutils 30 zlib 31 ]; 32 33 enableParallelBuilding = true; 34 makeFlags = [ 35 "PREFIX=$(out)" 36 "-C src" 37 ]; 38 39 passthru.tests = { 40 inherit knot-dns tracee; 41 bpf = nixosTests.bpf; 42 systemd = systemd.override { withLibBPF = true; }; 43 }; 44 45 postInstall = '' 46 # install linux's libbpf-compatible linux/btf.h 47 install -Dm444 include/uapi/linux/*.h -t $out/include/linux 48 ''; 49 50 # FIXME: Multi-output requires some fixes to the way the pkg-config file is 51 # constructed (it gets put in $out instead of $dev for some reason, with 52 # improper paths embedded). Don't enable it for now. 53 54 # outputs = [ "out" "dev" ]; 55 56 meta = with lib; { 57 description = "Library for loading eBPF programs and reading and manipulating eBPF objects from user-space"; 58 homepage = "https://github.com/libbpf/libbpf"; 59 license = with licenses; [ 60 lgpl21 # or 61 bsd2 62 ]; 63 maintainers = with maintainers; [ 64 thoughtpolice 65 vcunat 66 saschagrunert 67 martinetd 68 ]; 69 platforms = platforms.linux; 70 }; 71}