1{ lib
2, fetchFromGitHub
3, rustPlatform
4, clang
5, pkg-config
6, elfutils
7, rustfmt
8, zlib
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "below";
13 version = "0.8.1";
14
15 src = fetchFromGitHub {
16 owner = "facebookincubator";
17 repo = "below";
18 rev = "v${version}";
19 sha256 = "sha256-87Fdx3Jqi3dNWM5DZl+UYs031qn2DoiiWd3IysT/glQ=";
20 };
21
22 cargoHash = "sha256-y2fNypA0MrCdUI/K6QrZWw/5mkYafj2s6jrGHU2zGXw=";
23
24 prePatch = ''sed -i "s,ExecStart=.*/bin,ExecStart=$out/bin," etc/below.service'';
25 postInstall = ''
26 install -d $out/lib/systemd/system
27 install -t $out/lib/systemd/system etc/below.service
28 '';
29
30 # bpf code compilation
31 hardeningDisable = [ "stackprotector" "zerocallusedregs" ];
32
33 nativeBuildInputs = [ clang pkg-config rustfmt ];
34 buildInputs = [ elfutils zlib ];
35
36 # needs /sys/fs/cgroup
37 doCheck = false;
38
39 meta = with lib; {
40 platforms = platforms.linux;
41 maintainers = with maintainers; [ globin ];
42 description = "Time traveling resource monitor for modern Linux systems";
43 license = licenses.asl20;
44 homepage = "https://github.com/facebookincubator/below";
45 mainProgram = "below";
46 };
47}