diff options
author | Nick Cao <nickcao@nichi.co> | 2023-06-29 10:10:52 +0800 |
---|---|---|
committer | Nick Cao <nickcao@nichi.co> | 2023-07-17 15:59:48 +0800 |
commit | 002c2c038e0b62638891da954bbf124b45d1a4f9 (patch) | |
tree | b04786a578f76ff9e1a8f0d7eb5e9e794960f09b | |
parent | a8eaa43a38cd5e2e21268c5887da91a7cfc40637 (diff) |
bpftune: init at unstable-2023-05-30
-rw-r--r-- | pkgs/os-specific/linux/bpftune/default.nix | 64 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
2 files changed, 66 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/bpftune/default.nix b/pkgs/os-specific/linux/bpftune/default.nix new file mode 100644 index 0000000000000..09d5f47561918 --- /dev/null +++ b/pkgs/os-specific/linux/bpftune/default.nix @@ -0,0 +1,64 @@ +{ lib +, stdenv +, fetchFromGitHub +, clang +, bpftools +, docutils +, libbpf +, libcap +, libnl +}: + +stdenv.mkDerivation rec { + pname = "bpftune"; + version = "unstable-2023-05-30"; + + src = fetchFromGitHub { + owner = "oracle-samples"; + repo = "bpftune"; + rev = "bfec6668db29ec83afe2b030440f4d8f1476c1a6"; + hash = "sha256-is7y53c9pBSyywVW8hO0iHsVPQlsCb4LU/cJMGf9ua4="; + }; + + postPatch = '' + # otherwise shrink rpath would drop $out/lib from rpath + substituteInPlace src/Makefile \ + --replace /lib64 /lib \ + --replace /sbin /bin + substituteInPlace src/bpftune.service \ + --replace /usr/sbin/bpftune "$out/bin/bpftune" + substituteInPlace include/bpftune/libbpftune.h \ + --replace /usr/lib64/bpftune/ "$out/lib/bpftune/" \ + --replace /usr/local/lib64/bpftune/ "$out/lib/bpftune/" + ''; + + nativeBuildInputs = [ + clang + bpftools + docutils # rst2man + ]; + + buildInputs = [ + libbpf + libcap + libnl + ]; + + makeFlags = [ + "prefix=${placeholder "out"}" + "BPFTUNE_VERSION=${version}" + "BPF_INCLUDE=${lib.getDev libbpf}/include" + "NL_INCLUDE=${lib.getDev libnl}/include/libnl3" + ]; + + hardeningDisable = [ + "stackprotector" + ]; + + meta = with lib; { + description = "BPF-based auto-tuning of Linux system parameters"; + homepage = "https://github.com/oracle-samples/bpftune"; + license = licenses.gpl2Only; + maintainers = with maintainers; [ nickcao ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6194bb7a42aa4..41c5cf37130fc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27219,6 +27219,8 @@ with pkgs; bpf-linker = callPackage ../development/tools/bpf-linker { }; + bpftune = callPackage ../os-specific/linux/bpftune { }; + bpfmon = callPackage ../os-specific/linux/bpfmon { }; bridge-utils = callPackage ../os-specific/linux/bridge-utils { }; |