1{ lib
2, rustPlatform
3, fetchFromGitHub
4, installShellFiles
5, stdenv
6, nix-update-script
7, callPackage
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "cargo-asm";
12 version = "0.2.18";
13
14 src = fetchFromGitHub {
15 owner = "pacak";
16 repo = "cargo-show-asm";
17 rev = version;
18 hash = "sha256-K7hWXRS6bb9XZxIgZQeu22Gtt3WmXI63Xd97Unm6mHs=";
19 };
20
21 cargoHash = "sha256-PJ5v8uuRZZV2jcVS+a8/CAABekdsB+nvSJWI4cUHq0A=";
22
23 nativeBuildInputs = [
24 installShellFiles
25 ];
26
27 postInstall = ''
28 installShellCompletion --cmd cargo-asm \
29 --bash <($out/bin/cargo-asm --bpaf-complete-style-bash) \
30 --fish <($out/bin/cargo-asm --bpaf-complete-style-fish) \
31 --zsh <($out/bin/cargo-asm --bpaf-complete-style-zsh)
32 '';
33
34 passthru = {
35 updateScript = nix-update-script { };
36 tests = lib.optionalAttrs stdenv.hostPlatform.isx86_64 {
37 test-basic-x86_64 = callPackage ./test-basic-x86_64.nix { };
38 };
39 };
40
41 meta = with lib; {
42 description = "Cargo subcommand showing the assembly, LLVM-IR and MIR generated for Rust code";
43 homepage = "https://github.com/pacak/cargo-show-asm";
44 license = with licenses; [ asl20 mit ];
45 maintainers = with maintainers; [ figsoda oxalica ];
46 mainProgram = "cargo-asm";
47 };
48}