2021-11-13 13:36:35 +01:00
|
|
|
{ depot, pkgs, lib, ... }:
|
2021-05-12 16:00:39 +02:00
|
|
|
|
|
|
|
{ # content of the <title> tag
|
|
|
|
title
|
|
|
|
# main part of the page, usually wrapped with <main>
|
|
|
|
, content
|
|
|
|
# optional extra html to inject into <head>
|
|
|
|
, extraHead ? null
|
2021-09-28 22:26:38 +02:00
|
|
|
# optional extra html to inject into <footer>
|
|
|
|
, extraFooter ? null
|
2021-10-01 00:12:40 +02:00
|
|
|
# URL at which static assets are located
|
2021-10-01 18:46:06 +02:00
|
|
|
, staticUrl ? "https://static.tvl.fyi/${depot.web.static.drvHash}"
|
2021-05-12 16:00:39 +02:00
|
|
|
}@args:
|
|
|
|
|
|
|
|
let
|
2021-05-12 16:41:51 +02:00
|
|
|
inherit (pkgs) runCommandNoCC lib;
|
|
|
|
inherit (depot.tools) cheddar;
|
2021-05-12 16:00:39 +02:00
|
|
|
in
|
|
|
|
|
2021-11-13 13:36:35 +01:00
|
|
|
runCommandNoCC "${lib.strings.sanitizeDerivationName title}-index.html" {
|
2021-05-12 16:41:51 +02:00
|
|
|
headerPart = ''
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<meta name="description" content="The Virus Lounge">
|
2021-10-01 00:12:40 +02:00
|
|
|
<link rel="stylesheet" type="text/css" href="${staticUrl}/tvl.css" media="all">
|
|
|
|
<link rel="icon" type="image/webp" href="${staticUrl}/favicon.webp">
|
2021-11-30 10:51:30 +01:00
|
|
|
<link rel="alternate" type="application/atom+xml" title="Atom Feed" href="https://tvl.fyi/feed.atom">
|
2021-05-12 16:41:51 +02:00
|
|
|
<title>${title}</title>
|
|
|
|
'' + lib.optionalString (args ? extraHead) extraHead + ''
|
|
|
|
</head>
|
|
|
|
<body class="light">
|
|
|
|
'';
|
2021-05-12 16:00:39 +02:00
|
|
|
|
2021-05-12 16:41:51 +02:00
|
|
|
inherit content;
|
2021-05-12 16:00:39 +02:00
|
|
|
|
2021-05-12 16:41:51 +02:00
|
|
|
footerPart = ''
|
2021-05-12 16:00:39 +02:00
|
|
|
<hr>
|
|
|
|
<footer>
|
2021-11-05 13:41:10 +01:00
|
|
|
${depot.web.tvl.footer args}
|
2021-05-12 16:00:39 +02:00
|
|
|
</footer>
|
|
|
|
</body>
|
2021-05-12 16:41:51 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
passAsFile = [ "headerPart" "content" "footerPart" ];
|
|
|
|
} ''
|
|
|
|
${cheddar}/bin/cheddar --about-filter content.md < $contentPath > rendered.html
|
|
|
|
cat $headerPartPath rendered.html $footerPartPath > $out
|
|
|
|
''
|