flake-info: render longDescription for flake packages (#607)

This commit is contained in:
Naïm Favier 2023-02-05 10:24:26 +01:00 committed by GitHub
parent 188d618859
commit eb9fa64c33
Failed to generate hash of commit
3 changed files with 10 additions and 4 deletions

View file

@ -29,8 +29,9 @@ let
# paths = builtins.listToAttrs ( map (output: {name = output; value = drv.${output};}) drv.outputs );
default_output = drv.outputName;
}
// lib.optionalAttrs (drv ? meta && drv.meta ? description) { inherit (drv.meta) description; }
// lib.optionalAttrs (drv ? meta && drv.meta ? license) { inherit (drv.meta) license; }
// lib.optionalAttrs (drv ? meta.description) { inherit (drv.meta) description; }
// lib.optionalAttrs (drv ? meta.longDescription) { inherit (drv.meta) longDescription; }
// lib.optionalAttrs (drv ? meta.license) { inherit (drv.meta) license; }
)
) (validPkgs drvs);
readApps = system: apps: lib.mapAttrsToList (

View file

@ -115,6 +115,7 @@ impl TryFrom<(import::FlakeEntry, super::Flake)> for Derivation {
outputs,
default_output,
description,
long_description,
license,
} => {
let package_attr_set: Vec<_> = attribute_name.split(".").collect();
@ -125,6 +126,8 @@ impl TryFrom<(import::FlakeEntry, super::Flake)> for Derivation {
})
.into();
let long_description = long_description.map(|s| s.render_markdown()).transpose()?;
let package_license: Vec<License> = license
.map(OneOrMany::into_list)
.unwrap_or_default()
@ -152,7 +155,7 @@ impl TryFrom<(import::FlakeEntry, super::Flake)> for Derivation {
package_description: description.clone(),
package_maintainers: vec![maintainer.clone()],
package_maintainers_set: maintainer.name.map_or(vec![], |n| vec![n]),
package_longDescription: None,
package_longDescription: long_description,
package_hydra: (),
package_system: String::new(),
package_homepage: Vec::new(),
@ -251,7 +254,7 @@ impl TryFrom<import::NixpkgsEntry> for Derivation {
package_maintainers,
package_maintainers_set,
package_description: package.meta.description.clone(),
package_longDescription: long_description.clone(),
package_longDescription: long_description,
package_hydra: (),
package_system: package.system,
package_homepage: package

View file

@ -30,6 +30,8 @@ pub enum FlakeEntry {
outputs: Vec<String>,
default_output: String,
description: Option<String>,
#[serde(rename = "longDescription")]
long_description: Option<String>,
license: Option<OneOrMany<StringOrStruct<License>>>,
},
/// An "application" that can be called using nix run <..>