···
+
# BPF programs must be compiled with Clang
+
buildGoModule.override { stdenv = clangStdenv; } (finalAttrs: {
+
pname = "prometheus-ebpf-exporter";
+
src = fetchFromGitHub {
+
repo = "ebpf_exporter";
+
tag = "v${finalAttrs.version}";
+
hash = "sha256-zIevVZ4ldPj/4OvQFo+Nv/g//xNZEppO9ccB6y65rZA=";
+
vendorHash = "sha256-ZwKXIIoV4yEyjSpGjVDr91/CQmVuF9zc0IHkJYraE9o=";
+
substituteInPlace examples/Makefile \
+
--replace-fail "-Wall -Werror" ""
+
CGO_LDFLAGS = "-l bpf";
+
hardeningDisable = [ "zerocallusedregs" ];
+
"-X github.com/prometheus/common/version.Version=${finalAttrs.version}"
+
"-X github.com/prometheus/common/version.Revision=${finalAttrs.src.tag}"
+
"-X github.com/prometheus/common/version.Branch=${finalAttrs.src.tag}"
+
"-X github.com/prometheus/common/version.BuildUser=nix@nixpkgs"
+
"-X github.com/prometheus/common/version.BuildDate=unknown"
+
BUILD_LIBBPF=0 make examples
+
mv examples/*.o examples/*.yaml $out/examples
+
# Tests fail on trying to access cgroups.
+
nativeInstallCheckInputs = [ versionCheckHook ];
+
versionCheckProgramArg = "--version";
+
updateScript = nix-update-script { };
+
tests = { inherit (nixosTests.prometheus-exporters) ebpf; };
+
description = "Prometheus exporter for custom eBPF metrics";
+
mainProgram = "ebpf_exporter";
+
homepage = "https://github.com/cloudflare/ebpf_exporter";
+
changelog = "https://github.com/cloudflare/ebpf_exporter/releases/tag/${finalAttrs.src.tag}";
+
license = lib.licenses.mit;
+
maintainers = with lib.maintainers; [
+
platforms = lib.platforms.linux;