lol

Merge pull request #196390 from oxalica/pkg/cargo-show-asm

cargo-show-asm: init at 0.1.24

authored by

figsoda and committed by
GitHub
d1fdabc1 1aa7d4e6

+71
+50
pkgs/development/tools/rust/cargo-show-asm/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , rustPlatform 5 + , pkg-config 6 + , installShellFiles 7 + , openssl 8 + , nix-update-script 9 + , callPackage 10 + }: 11 + rustPlatform.buildRustPackage rec { 12 + pname = "cargo-asm"; 13 + version = "0.1.24"; 14 + 15 + src = fetchFromGitHub { 16 + owner = "pacak"; 17 + repo = "cargo-show-asm"; 18 + rev = version; 19 + hash = "sha256-ahkKUtg5M88qddzEwYxPecDtBofGfPVxKuYKgmsbWYc="; 20 + }; 21 + 22 + cargoHash = "sha256-S7OpHNjiTfQg7aPmHEx6Q/OV5QA9pB29F3MTIeiLAXg="; 23 + 24 + nativeBuildInputs = [ pkg-config installShellFiles ]; 25 + buildInputs = [ openssl ]; 26 + 27 + postInstall = '' 28 + installShellCompletion --cmd foobar \ 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 + attrPath = pname; 37 + }; 38 + tests = lib.optionalAttrs stdenv.hostPlatform.isx86_64 { 39 + test-basic-x86_64 = callPackage ./test-basic-x86_64.nix { }; 40 + }; 41 + }; 42 + 43 + meta = with lib; { 44 + description = "Cargo subcommand showing the assembly, LLVM-IR and MIR generated for Rust code"; 45 + homepage = "https://github.com/pacak/cargo-show-asm"; 46 + license = with licenses; [ asl20 mit ]; 47 + maintainers = with maintainers; [ oxalica ]; 48 + broken = stdenv.isDarwin; # FIXME: Seems to have issue compiling bundled curl. 49 + }; 50 + }
+18
pkgs/development/tools/rust/cargo-show-asm/test-basic-x86_64.nix
··· 1 + { runCommand, cargo, rustc, cargo-show-asm }: 2 + runCommand "test-basic" { 3 + nativeBuildInputs = [ cargo rustc cargo-show-asm ]; 4 + } '' 5 + mkdir -p src 6 + cat >Cargo.toml <<EOF 7 + [package] 8 + name = "add" 9 + version = "0.0.0" 10 + EOF 11 + cat >src/lib.rs <<EOF 12 + pub fn add(a: u32, b: u32) -> u32 { a + b } 13 + EOF 14 + 15 + [[ "$(cargo asm add::add | tee /dev/stderr)" == *"lea eax, "* ]] 16 + [[ "$(cargo asm --mir add | tee /dev/stderr)" == *"= Add("* ]] 17 + touch $out 18 + ''
+3
pkgs/top-level/all-packages.nix
··· 14896 14896 cargo-semver-checks = callPackage ../development/tools/rust/cargo-semver-checks { 14897 14897 inherit (darwin.apple_sdk.frameworks) Security; 14898 14898 }; 14899 + 14900 + cargo-show-asm = callPackage ../development/tools/rust/cargo-show-asm { }; 14901 + 14899 14902 cargo-sort = callPackage ../development/tools/rust/cargo-sort { }; 14900 14903 cargo-spellcheck = callPackage ../development/tools/rust/cargo-spellcheck { 14901 14904 inherit (darwin.apple_sdk.frameworks) Security;