diff --git a/nix/passthru-vendored.nix b/nix/passthru-vendored.nix index 37496bb..1aa118d 100644 --- a/nix/passthru-vendored.nix +++ b/nix/passthru-vendored.nix @@ -6,7 +6,7 @@ # This could be done much more elegantly if `buildRustPackage` supported # finalAttrs. When https://github.com/NixOS/nixpkgs/pull/194475 lands, we can # most likely get rid of this. - rust = package: { cargo-cyclonedx }: package.overrideAttrs + rust = package: { cargo-cyclonedx, lib, stdenv }: package.overrideAttrs (previousAttrs: { passthru = (previousAttrs.passthru or { }) // { bombonVendoredSbom = package.overrideAttrs (previousAttrs: { @@ -14,8 +14,15 @@ outputs = [ "out" ]; phases = [ "unpackPhase" "patchPhase" "configurePhase" "buildPhase" "installPhase" ]; buildPhase = '' - cargo cyclonedx --spec-version 1.4 --format json - ''; + cargo cyclonedx --spec-version 1.4 --format json --target ${stdenv.hostPlatform.rust.rustcTarget} + '' + + lib.optionalString + (builtins.hasAttr "buildNoDefaultFeatures" previousAttrs) + " --no-default-features" + + lib.optionalString + (builtins.hasAttr "buildFeatures" previousAttrs) + (" --features " + builtins.concatStringsSep "," previousAttrs.buildFeatures) + ; installPhase = '' mkdir -p $out find . -name "*.cdx.json" -execdir install {} $out/{} \; @@ -24,5 +31,4 @@ }); }; }); - }