packages.bonfire-docs: fix license generation for multiple licenses
Some checks failed
nix / check (push) Failing after 3m17s

This commit is contained in:
L-Nafaryus 2024-08-09 16:56:27 +05:00
parent 464d0e848a
commit 30c99f8d8d
Signed by: L-Nafaryus
GPG Key ID: 553C97999B363D38
2 changed files with 19 additions and 4 deletions

View File

@ -53,15 +53,18 @@ in
dontConfigure = true; dontConfigure = true;
doCheck = false; doCheck = false;
buildPhase = '' buildPhase = let
nixosModulesDocsList = map (module_: "ln -s ${module_.commonMarkdown} src/nixosModules/${module_.name}.md") nixosModulesDoc.documentation;
packageDocsList = map (package_: "ln -s ${package_.commonMarkdown} src/packages/${package_.name}.md") packagesDoc.documentation;
in ''
runHook preBuild runHook preBuild
ln -s ${../../README.md} src/README.md ln -s ${../../README.md} src/README.md
${lib.concatStringsSep "\n" (map (module_: "ln -s ${module_.commonMarkdown} src/nixosModules/${module_.name}.md") nixosModulesDoc.documentation)} ${lib.concatStringsSep "\n" nixosModulesDocsList}
substituteInPlace src/SUMMARY.md --replace '{{nixosModulesSummary}}' '${lib.concatStringsSep "\n" nixosModulesDoc.summary}' substituteInPlace src/SUMMARY.md --replace '{{nixosModulesSummary}}' '${lib.concatStringsSep "\n" nixosModulesDoc.summary}'
${lib.concatStringsSep "\n" (map (package_: "ln -s ${package_.commonMarkdown} src/packages/${package_.name}.md") packagesDoc.documentation)} ${lib.concatStringsSep "\n" packageDocsList}
substituteInPlace src/SUMMARY.md --replace '{{packagesSummary}}' '${lib.concatStringsSep "\n" packagesDoc.summary}' substituteInPlace src/SUMMARY.md --replace '{{packagesSummary}}' '${lib.concatStringsSep "\n" packagesDoc.summary}'
mdbook build mdbook build

View File

@ -46,7 +46,19 @@
license = lib.optionalString (drv.meta ? license) "License: ${ license = lib.optionalString (drv.meta ? license) "License: ${
if lib.isList drv.meta.license if lib.isList drv.meta.license
then (map (license: "[${drv.meta.license.fullName}](${drv.meta.license.url})") drv.meta.license) then
lib.concatStringsSep ", " (map (license: let
licenseName =
if license.free
then license.fullName
else if license ? shortName
then license.shortName
else license.fullName;
in
if license ? url
then "[${licenseName}](${license.url})"
else licenseName)
drv.meta.license)
else "[${drv.meta.license.fullName}](${drv.meta.license.url})" else "[${drv.meta.license.fullName}](${drv.meta.license.url})"
}"; }";