Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pkgs/development/tools/rust/cargo-llvm-cov/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{ lib, rustPlatform, fetchCrate, fetchFromGitHub, libllvm, makeBinaryWrapper }:

rustPlatform.buildRustPackage rec {
pname = "cargo-llvm-cov";
version = "0.4.14";

src = fetchCrate {
inherit pname version;
sha256 = "sha256-DY5eBSx/PSmKaG7I6scDEbyZQ5hknA/pfl0KjTNqZlo=";
};

postPatch = ''
rm tests/test.rs
'';

nativeBuildInputs = [ makeBinaryWrapper ];
Comment thread
winterqt marked this conversation as resolved.
buildInputs = [ libllvm ];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use the same libllvm as rustc (e.g. rustPlatform.rust.rustc.llvmPackages.libllvm)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is different because it's an older version, but I didn't need to add any buildInputs at all to get 0.5.0 to build/function.

@winterqt winterqt Oct 24, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks like libllvm was never required, at least on 0.4.13.

@DieracDelta Do you remember why you added it, out of curiosity?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no recollection of adding this. If it works without libllvm, then let's drop the dependency 👍


LLVM_COV = "${rustPlatform.rust.rustc.llvmPackages.llvm}/bin/llvm-cov";
LLVM_PROFDATA = "${rustPlatform.rust.rustc.llvmPackages.llvm}/bin/llvm-profdata";
Comment thread
winterqt marked this conversation as resolved.

postInstall = ''
wrapProgram $out/bin/cargo-llvm-cov \
--set LLVM_COV "${rustPlatform.rust.rustc.llvmPackages.llvm}/bin/llvm-cov" \
--set LLVM_PROFDATA "${rustPlatform.rust.rustc.llvmPackages.llvm}/bin/llvm-profdata"
Comment thread
winterqt marked this conversation as resolved.
'';

cargoSha256 = "sha256-MGI1wV0QEZRxea6Q3fh2TJVPmI4eb9O6/DwpKkWrToE=";

meta = with lib; {
description = "Cargo subcommand to gather source-based code coverage using LLVM";
homepage = "https://github.com/taiki-e/cargo-llvm-cov";
license = with licenses; [ mit asl20 ];
maintainers = with maintainers; [ DieracDelta matthiasbeyer ];
};
}
1 change: 1 addition & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14251,6 +14251,7 @@ with pkgs;
cargo-kcov = callPackage ../development/tools/rust/cargo-kcov { };
cargo-graph = callPackage ../development/tools/rust/cargo-graph { };
cargo-license = callPackage ../development/tools/rust/cargo-license { };
cargo-llvm-cov = callPackage ../development/tools/rust/cargo-llvm-cov { };
cargo-llvm-lines = callPackage ../development/tools/rust/cargo-llvm-lines { };
cargo-outdated = callPackage ../development/tools/rust/cargo-outdated {
inherit (darwin.apple_sdk.frameworks) Security SystemConfiguration;
Expand Down