core/pkgs/by-name/ru/rust/cargo-auditable-cargo-wrapper.nix

37 lines
821 B
Nix
Raw Normal View History

2024-06-30 08:12:46 +00:00
{
lib,
runCommand,
makeBinaryWrapper,
rust-audit-info,
cargo,
cargo-auditable,
}:
2024-05-02 00:46:19 +00:00
if cargo-auditable.meta.broken then
cargo
else
2024-06-30 08:12:46 +00:00
runCommand "auditable-${cargo.name}"
{
nativeBuildInputs = [ makeBinaryWrapper ];
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
passthru.tests = runCommand "rust-audit-info-test" { nativeBuildInputs = [ rust-audit-info ]; } ''
rust-audit-info ${lib.getBin rust-audit-info}/bin/rust-audit-info > $out
'';
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
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
''