Skip to content

Commit

Permalink
overview: Add Pandoc and v.Nu
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzleutgeb committed Mar 28, 2024
1 parent 4f283bf commit ea75076
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,16 @@
// {
overview =
pkgs.runCommand "overview" {
nativeBuildInputs = with pkgs; [ jq pandoc validator-nu ];
build = pkgs.writeTextFile {
name = "overview.html";
text = import ./overview.nix self pkgs.lib importPack optionsDoc.optionsNix;
};
} ''
mkdir $out
cp $build $out/index.html
echo "<!DOCTYPE html>" > $out/index.html
pandoc --from=markdown+raw_html --to=html < $build >> $out/index.html
vnu --Werror --format json $out 2>&1 | jq
'';

options =
Expand Down
8 changes: 4 additions & 4 deletions overview.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ self: lib: packages: options: let
thisOption = actual: expected: startsWith expected actual;
anyOption = options: actual: builtins.any (thisOption actual) (map concatDot options);

header = "<html><head><title>${self.rev or self.dirtyRev}</title></head><body>";
footer = "</body></html>";
header = "<html lang=\"en\"><head><title>NGIpkgs Overview</title></head><body>";
footer = "<hr><footer>Version: ${self.rev or self.dirtyRev}</footer></body></html>";

ngiDetails = ngi: "<p><b>NLNet Project:</b> <a href=\"https://nlnet.nl/project/${ngi.project}\">${ngi.project}</a></p>";

myoption = name: value: "<dt><code>${name}</code></dt><dd><table><tr><td>Type</td><td>${value.type}</td></tr><tr><td>Description</td><td>${value.description}</td></tr></table></dd>";
myoption = name: value: "<dt>`name`</dt><dd><table><tr><td>Type</td><td>${value.type}</td></tr><tr><td>Description</td><td>${value.description}</td></tr></table></dd>";
in
header
+ "<h1>Packages</h1>"
+ builtins.concatStringsSep "" (
builtins.attrValues
(builtins.mapAttrs (
name: x:
"<section><h2>Package: <code>${name}</code></h2>"
"<section><h2>Package: `${name}`</h2>"
+ (
if x ? meta.ngi
then ngiDetails x.meta.ngi
Expand Down

0 comments on commit ea75076

Please sign in to comment.