depot/pkgs/development/compilers/rust/cargo-auditable-cargo-wrapper.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

24 lines
694 B
Nix

{ lib, runCommand, makeBinaryWrapper, rust-audit-info, cargo, cargo-auditable }:
if cargo-auditable.meta.broken then
cargo
else
runCommand "auditable-${cargo.name}" {
nativeBuildInputs = [ makeBinaryWrapper ];
passthru.tests = runCommand "rust-audit-info-test" {
nativeBuildInputs = [ rust-audit-info ];
} ''
rust-audit-info ${lib.getBin rust-audit-info}/bin/rust-audit-info > $out
'';
meta = cargo-auditable.meta // {
mainProgram = "cargo";
};
} ''
mkdir -p $out/bin
makeWrapper ${cargo}/bin/cargo $out/bin/cargo \
--set CARGO_AUDITABLE_IGNORE_UNSUPPORTED 1 \
--prefix PATH : ${lib.makeBinPath [ cargo cargo-auditable ]} \
--add-flags auditable
''