nixpkgs/pkgs/development/compilers/rust/cargo-auditable-cargo-wrapper.nix
Adam Joseph bac515fa9d
cargo-auditable-cargo-wrapper: don't wrap if cargo-auditable is meta.broken (#250615)
Recent changes to `cargo-auditable-cargo-wrapper` and `librsvg`
caused it to ignore the user's decision to opt out of `cargo-audit`
functionality, partially because `librsvg` does not use
`buildRustPackage`.

This commit restores the single-point-of-opt-out from this mis-named
functionality: `cargo-auditable.meta.broken`.

Co-authored-by: figsoda <figsoda@pm.me>
2023-08-26 16:07:05 -05:00

25 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
''