mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
75 lines
1.6 KiB
Nix
75 lines
1.6 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, clang
|
|
, bpftools
|
|
, docutils
|
|
, libbpf
|
|
, libcap
|
|
, libnl
|
|
, nixosTests
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "bpftune";
|
|
version = "0-unstable-2024-10-25";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "oracle";
|
|
repo = "bpftune";
|
|
rev = "6a50f5ff619caeea6f04d889e3a60de6c12feb76";
|
|
hash = "sha256-yol6VFelqQiPKLg1UUeP+r/+XO4fjYeDbIeI29gZ7j4=";
|
|
};
|
|
|
|
postPatch = ''
|
|
# otherwise shrink rpath would drop $out/lib from rpath
|
|
substituteInPlace src/Makefile \
|
|
--replace-fail /sbin /bin \
|
|
--replace-fail ldconfig true
|
|
substituteInPlace src/bpftune.service \
|
|
--replace-fail /usr/sbin/bpftune "$out/bin/bpftune"
|
|
substituteInPlace src/libbpftune.c \
|
|
--replace-fail /lib/modules /run/booted-system/kernel-modules/lib/modules
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
clang
|
|
bpftools
|
|
docutils # rst2man
|
|
];
|
|
|
|
buildInputs = [
|
|
libbpf
|
|
libcap
|
|
libnl
|
|
];
|
|
|
|
makeFlags = [
|
|
"prefix=${placeholder "out"}"
|
|
"confprefix=${placeholder "out"}/etc"
|
|
"libdir=lib"
|
|
"BPFTUNE_VERSION=${version}"
|
|
"NL_INCLUDE=${lib.getDev libnl}/include/libnl3"
|
|
"BPF_INCLUDE=${lib.getDev libbpf}/include"
|
|
];
|
|
|
|
hardeningDisable = [
|
|
"stackprotector"
|
|
"zerocallusedregs"
|
|
];
|
|
|
|
passthru.tests = {
|
|
inherit (nixosTests) bpftune;
|
|
};
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
meta = with lib; {
|
|
description = "BPF-based auto-tuning of Linux system parameters";
|
|
mainProgram = "bpftune";
|
|
homepage = "https://github.com/oracle-samples/bpftune";
|
|
license = licenses.gpl2Only;
|
|
maintainers = with maintainers; [ nickcao ];
|
|
};
|
|
}
|