Skip to content

Commit

Permalink
Include ref, version, and description
Browse files Browse the repository at this point in the history
  • Loading branch information
Erin van der Veen committed Dec 13, 2023
1 parent 2c1bbda commit e74038c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ pub(crate) struct Model {
pub(crate) struct ModelComponent {
pub(crate) r#type: ModelType,
pub(crate) name: String,
/// A unique identifier op the component to be used as a reference elsewhere in the sbom
pub(crate) r#ref: String,
pub(crate) version: String,
pub(crate) description: String,
}

#[derive(Debug)]
Expand All @@ -35,6 +39,9 @@ impl From<ModelComponent> for cyclonedx::Component {
cyclonedx::ComponentBuilder::default()
.type_(model_component.r#type)
.name(model_component.name)
.bom_ref(model_component.r#ref)
.version(model_component.version)
.description(model_component.description)
.build()
.unwrap()
}
Expand Down
6 changes: 5 additions & 1 deletion src/nixtract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub(crate) struct NixtractParsedName {

#[derive(Deserialize, Debug)]
pub(crate) struct NixtractNixpkgsMetadata {
pub(crate) description: String,
pub(crate) pname: String,
pub(crate) version: String,
pub(crate) broken: bool,
Expand All @@ -48,7 +49,7 @@ pub(crate) struct NixtractNixpkgsMetadata {
pub(crate) struct NixtractBuiltInput {
pub(crate) attribute_path: String,
pub(crate) build_input_type: String,
pub(crate) output_path: String,
pub(crate) output_path: Option<String>,
}

impl From<Nixtract> for Model {
Expand All @@ -59,6 +60,9 @@ impl From<Nixtract> for Model {
.map(|entry| ModelComponent {
r#type: ModelType::Application,
name: entry.parsed_name.name,
r#ref: entry.output_path,
version: entry.nixpkgs_metadata.version,
description: entry.nixpkgs_metadata.description,
})
.collect();

Expand Down

0 comments on commit e74038c

Please sign in to comment.