Files
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

78 lines
1.7 KiB
Nix

{
fetchFromGitHub,
elfutils,
pkg-config,
stdenv,
zlib,
lib,
# for passthru.tests
knot-dns,
nixosTests,
systemd,
tracee,
}:
stdenv.mkDerivation rec {
pname = "libbpf";
version = "1.6.2";
src = fetchFromGitHub {
owner = "libbpf";
repo = "libbpf";
rev = "v${version}";
hash = "sha256-igjjwirg3O5mC3DzGCAO9OgrH2drnE/gV6NH7ZLNnFE=";
};
patches = [
# Fix redefinition when using linux/netlink.h from libbpf with musl
# https://github.com/libbpf/libbpf/pull/919
./sync-uapi-move-constants-from-linux-kernel-h-to-linux-const-h.patch
];
nativeBuildInputs = [ pkg-config ];
buildInputs = [
elfutils
zlib
];
enableParallelBuilding = true;
makeFlags = [
"PREFIX=$(out)"
"-C src"
];
passthru.tests = {
inherit knot-dns tracee;
bpf = nixosTests.bpf;
systemd = systemd.override { withLibBPF = true; };
};
postInstall = ''
# install linux's libbpf-compatible linux/btf.h
install -Dm444 include/uapi/linux/*.h -t $out/include/linux
'';
# FIXME: Multi-output requires some fixes to the way the pkg-config file is
# constructed (it gets put in $out instead of $dev for some reason, with
# improper paths embedded). Don't enable it for now.
# outputs = [ "out" "dev" ];
meta = with lib; {
description = "Library for loading eBPF programs and reading and manipulating eBPF objects from user-space";
homepage = "https://github.com/libbpf/libbpf";
license = with licenses; [
lgpl21 # or
bsd2
];
maintainers = with maintainers; [
thoughtpolice
vcunat
saschagrunert
martinetd
];
platforms = platforms.linux;
};
}