Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, rustPlatform
3, fetchCrate
4, jq
5, moreutils
6, stdenv
7, darwin
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "samply";
12 version = "0.12.0";
13
14 src = fetchCrate {
15 inherit pname version;
16 hash = "sha256-7bf1lDIZGhRpvnn8rHNwzH2GBY8CwtYCjuRAUTQgbsA=";
17 };
18
19 cargoHash = "sha256-QGvtKx+l6+UxdlziHnF63geAvW55RRlatK2/J8LR0Ck=";
20
21 # the dependencies linux-perf-data and linux-perf-event-reader contains both README.md and Readme.md,
22 # which causes a hash mismatch on systems with a case-insensitive filesystem
23 # this removes the readme files and updates cargo's checksum file accordingly
24 depsExtraArgs = {
25 nativeBuildInputs = [
26 jq
27 moreutils
28 ];
29
30 postBuild = ''
31 for crate in linux-perf-data linux-perf-event-reader; do
32 pushd $name/$crate
33
34 rm -f README.md Readme.md
35 jq 'del(.files."README.md") | del(.files."Readme.md")' \
36 .cargo-checksum.json -c \
37 | sponge .cargo-checksum.json
38
39 popd
40 done
41 '';
42 };
43
44 buildInputs = lib.optionals stdenv.isDarwin [
45 darwin.apple_sdk.frameworks.CoreServices
46 ];
47
48 meta = with lib; {
49 description = "Command line profiler for macOS and Linux";
50 mainProgram = "samply";
51 homepage = "https://github.com/mstange/samply";
52 changelog = "https://github.com/mstange/samply/releases/tag/samply-v${version}";
53 license = with licenses; [ asl20 mit ];
54 maintainers = with maintainers; [ figsoda ];
55 };
56}