Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flake-info: render longDescription for flake packages #607

Merged
merged 1 commit into from
Feb 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions flake-info/assets/commands/flake_info.nix
Original file line number Diff line number Diff line change
@@ -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 (
7 changes: 5 additions & 2 deletions flake-info/src/data/export.rs
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions flake-info/src/data/import.rs
Original file line number Diff line number Diff line change
@@ -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 <..>