Skip to content

Commit

Permalink
lib/documentation: don't require licenses to have an URL
Browse files Browse the repository at this point in the history
lib.licenses.free for example doesn't have an URL

Fixes #46
  • Loading branch information
minijackson committed Apr 5, 2024
1 parent fefa2bf commit 3f5615f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/documentation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,21 @@
in
mapRecursiveDrvsToList' "" f attrset;

maybeUrl = text: destination:
if destination == null
then text
else "[${text}](${destination})";

licenseLink = license: self.maybeUrl license.fullName (license.url or null);

licenseList = pkg:
if lib.isList pkg.meta.license
then
lib.concatMapStringsSep
"\n"
(license: " - [${license.fullName}](${license.url})")
(license: " - ${self.licenseLink license}")
pkg.meta.license
else " - [${pkg.meta.license.fullName}](${pkg.meta.license.url})";
else " - ${self.licenseLink pkg.meta.license}";

maintainerInfo = maintainer:
if maintainer ? github
Expand Down

0 comments on commit 3f5615f

Please sign in to comment.