Files
nixpkgs/pkgs/by-name/bp/bpftune/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

80 lines
1.7 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
clang,
bpftools,
docutils,
libbpf,
libcap,
libnl,
nixosTests,
unstableGitUpdater,
}:
stdenv.mkDerivation rec {
pname = "bpftune";
version = "0-unstable-2025-03-20";
src = fetchFromGitHub {
owner = "oracle";
repo = "bpftune";
rev = "8c6a3ffc09265bd44ed89b75c400ef97959d1aff";
hash = "sha256-TQ8WaGvMcvyeZC4B9gSjJ2k5NOxpTaV4n7Qi36aA78Q=";
};
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;
};
updateScript = unstableGitUpdater { };
};
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 ];
};
}