Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 77 lines 1.8 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, clang 5, bpftools 6, docutils 7, libbpf 8, libcap 9, libnl 10, nixosTests 11}: 12 13stdenv.mkDerivation rec { 14 pname = "bpftune"; 15 version = "0-unstable-2024-06-07"; 16 17 src = fetchFromGitHub { 18 owner = "oracle"; 19 repo = "bpftune"; 20 rev = "04bab5dd306b55b3e4e13e261af2480b7ccff9fc"; 21 hash = "sha256-kVjvupZ6HxJocwXWOrxUNqEGl0welJRlZwvOmMKqeBA="; 22 }; 23 24 postPatch = '' 25 # otherwise shrink rpath would drop $out/lib from rpath 26 substituteInPlace src/Makefile \ 27 --replace-fail /lib64 /lib \ 28 --replace-fail /sbin /bin \ 29 --replace-fail ldconfig true 30 substituteInPlace src/bpftune.service \ 31 --replace-fail /usr/sbin/bpftune "$out/bin/bpftune" 32 substituteInPlace include/bpftune/libbpftune.h \ 33 --replace-fail /usr/lib64/bpftune/ "$out/lib/bpftune/" \ 34 --replace-fail /usr/local/lib64/bpftune/ "$out/lib/bpftune/" 35 substituteInPlace src/libbpftune.c \ 36 --replace-fail /lib/modules /run/booted-system/kernel-modules/lib/modules 37 ''; 38 39 nativeBuildInputs = [ 40 clang 41 bpftools 42 docutils # rst2man 43 ]; 44 45 buildInputs = [ 46 libbpf 47 libcap 48 libnl 49 ]; 50 51 makeFlags = [ 52 "prefix=${placeholder "out"}" 53 "confprefix=${placeholder "out"}/etc" 54 "BPFTUNE_VERSION=${version}" 55 "NL_INCLUDE=${lib.getDev libnl}/include/libnl3" 56 "BPF_INCLUDE=${lib.getDev libbpf}/include" 57 ]; 58 59 hardeningDisable = [ 60 "stackprotector" 61 "zerocallusedregs" 62 ]; 63 64 passthru.tests = { 65 inherit (nixosTests) bpftune; 66 }; 67 68 enableParallelBuilding = true; 69 70 meta = with lib; { 71 description = "BPF-based auto-tuning of Linux system parameters"; 72 mainProgram = "bpftune"; 73 homepage = "https://github.com/oracle-samples/bpftune"; 74 license = licenses.gpl2Only; 75 maintainers = with maintainers; [ nickcao ]; 76 }; 77}