-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from nikstur/vendored-dependencies
Read vendored dependencies from passthru
- Loading branch information
Showing
8 changed files
with
129 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
{ pkgs }: rec { | ||
{ pkgs }: | ||
|
||
transformer = pkgs.callPackage ./nix/packages/transformer.nix { }; | ||
let | ||
passthruVendoredSbom = import ./nix/passthru-vendored.nix; | ||
transformerWithoutSbom = pkgs.callPackage ./nix/packages/transformer.nix { }; | ||
in | ||
rec { | ||
|
||
buildBom = pkgs.callPackage ./nix/build-bom.nix { | ||
inherit transformer; | ||
# It's useful to have these exposed for debugging. However, they are not a | ||
# public interface. | ||
__internal = { | ||
buildtimeDependencies = pkgs.callPackage ./nix/buildtime-dependencies.nix { }; | ||
runtimeDependencies = pkgs.callPackage ./nix/runtime-dependencies.nix { }; | ||
}; | ||
|
||
transformer = pkgs.callPackage (passthruVendoredSbom.rust transformerWithoutSbom) { }; | ||
|
||
buildBom = pkgs.callPackage ./nix/build-bom.nix { | ||
inherit transformer; | ||
inherit (__internal) buildtimeDependencies runtimeDependencies; | ||
}; | ||
|
||
inherit passthruVendoredSbom; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
|
||
# Add a passthru derivation to a Rust derivation `package` that generates a | ||
# CycloneDX SBOM. | ||
# | ||
# 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 | ||
(previousAttrs: { | ||
passthru = (previousAttrs.passthru or { }) // { | ||
bombonVendoredSbom = package.overrideAttrs (previousAttrs: { | ||
nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [ cargo-cyclonedx ]; | ||
phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" ]; | ||
buildPhase = '' | ||
cargo cyclonedx --spec-version 1.4 --format json | ||
''; | ||
installPhase = '' | ||
mkdir -p $out | ||
find . -name "*.cdx.json" -exec install {} $out/{} \; | ||
''; | ||
}); | ||
}; | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters