dreamstop.openfp.net, the website and user manual of dreamstop, a language for continuous disambiguation
git clone git@nixlab.openfp.net:web/dreamstop.openfp.net.gitlocal:
{
# The systems horizon-javascript offers a GHC for.
systems = builtins.filter (s: local.inputs.horizon-javascript.legacyPackages.${s} ? ghc) (
builtins.attrNames local.inputs.horizon-javascript.legacyPackages
);
perSystem =
{
config,
pkgs,
system,
...
}:
let
inherit (local.inputs.nixpkgs) lib;
inherit (local.inputs) design-kit;
hl = pkgs.haskell.lib.compose;
kit = import "${design-kit}/site.nix" { inherit pkgs; };
jsSet = local.inputs.horizon-javascript.legacyPackages.${system};
siteSet = config.legacyPackages;
inkwellSet = local.inputs.inkwell-dsl.legacyPackages.${system};
inkwellEnvironment = inkwellSet.shellFor {
packages = _: [ ];
extraDependencies = p: {
libraryHaskellDepends = [ p.inkwell-dsl ];
};
};
manualFonts = "${pkgs.dejavu_fonts}/share/fonts";
manual =
pkgs.runCommand "dreamstop.openfp.net-manual"
{
inherit (inkwellEnvironment) NIX_GHC NIX_GHCPKG NIX_GHC_LIBDIR;
nativeBuildInputs = [ pkgs.typst ];
LANG = "C.UTF-8";
LC_ALL = "C.UTF-8";
}
''
mkdir -p $out/manual
${lib.getExe' inkwellSet.inkwell-dsl "inkwell-render"} ${../manual/dreamstop.vx} \
"$("$NIX_GHC" --print-global-package-db)" > dreamstop.typ
typst compile --font-path ${manualFonts} dreamstop.typ $out/manual/dreamstop.pdf
typst compile --features html --format html --font-path ${manualFonts} \
dreamstop.typ $out/manual/index.html
'';
# The manual names neither Ithkuil nor Quijada.
manualSays =
pkgs.runCommand "dreamstop.openfp.net-manual-says"
{
LANG = "C.UTF-8";
LC_ALL = "C.UTF-8";
}
''
for t in Ithkuil Quijada; do
if grep -qiF "$t" ${manual}/manual/index.html; then echo "manual: it names $t" >&2; exit 1; fi
done
touch $out
'';
name = "dreamstop";
title = "dreamstop — a language for continuous disambiguation";
description = "dreamstop is a language for continuous disambiguation. Readers annotate each sentence, and authors rewrite any sentence that is not clear.";
card = "https://dreamstop.openfp.net/og.png";
forge = "https://nixlab.openfp.net";
meta =
key: n: value:
''<meta ${key}="${n}" content="${value}" />'';
site = kit.mkSite {
hsPkgs = siteSet;
name = "dreamstop-openfp-net-web";
static = [
../dreamstop.svg
manual
];
css = [ ../dreamstop.css ];
card = {
svg = ../og.svg;
extraFiles = [ ../dreamstop.svg ];
};
flakeLock = ../flake.lock;
horizonVx = ../horizon.vx;
expect = [
''<a class="btn" id="manual" href="manual/">Read the manual</a>''
{ absent = "Ithkuil"; }
{ absent = "Continuous Disambiguation"; }
''<a href="${forge}/web/dreamstop.openfp.net">Page source</a>''
''<link rel="icon" href="dreamstop.svg"''
''<script src="site.js" defer></script>''
(meta "property" "og:type" "website")
(meta "property" "og:site_name" name)
(meta "property" "og:title" title)
(meta "name" "twitter:title" title)
(meta "name" "description" description)
(meta "property" "og:description" description)
(meta "name" "twitter:description" description)
(meta "property" "og:url" "https://dreamstop.openfp.net/")
(meta "property" "og:image" card)
(meta "name" "twitter:image" card)
(meta "property" "og:image:width" "1200")
(meta "property" "og:image:height" "627")
(meta "property" "og:image:type" "image/png")
(meta "name" "twitter:card" "summary_large_image")
];
nojsText = [ "Read the manual" ];
};
cardCopy = pkgs.runCommand "dreamstop.openfp.net-card-copy" { } ''
tagline=$(tr '\n' ' ' < ${../og.svg} | grep -oE '<text id="tagline".*' | sed -E 's#</text>.*##; s#<[^>]*># #g' | tr -s ' ' | sed -E 's/^ //; s/ $//')
[ "$tagline" = "a language for continuous disambiguation" ] || { echo "card: the card must say the tagline, not '$tagline'" >&2; exit 1; }
grep -qF '<image href="dreamstop.svg"' ${../og.svg} || { echo "card: the card must show the page's dreamstop.svg" >&2; exit 1; }
touch $out
'';
in
{
horizon.overlay = {
basePackages = jsSet;
overlays = [
(_final: prev: lib.mapAttrs (name: _: hl.dontHaddock prev.${name}) config.horizon.pkgs)
];
};
packages = {
default = site.package;
inherit manual;
};
apps.serve = {
type = "app";
program = toString site.serve;
};
checks = site.checks // {
card-copy = cardCopy;
manual-says = manualSays;
};
};
}