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