{ pkgs, blog-source, katex-html, resume }:
with pkgs;
with lib;
let
protocol = ssl: if ssl then "https://" else "http://";
website = settings: stdenv.mkDerivation {
inherit (settings) src ssl host;
inherit resume;
name = "blog-static";
version = settings.src.rev or "dirty";
publicPath = settings.path;
hugoFlags = concatStringsSep " " (
optionals settings.drafts (singleton "-D") ++
[ "--baseURL=${protocol settings.ssl + settings.host}" ]
);
builder = ./build/builder.sh;
buildInputs = [
hugo ruby stork katex-html
];
};
in
{
english = settings: website {
inherit (settings) host;
ssl = settings.ssl or false;
drafts = settings.drafts or false;
src = blog-source;
path = ".";
};
virtualHostFor = package:
{
"${package.host}" = mkMerge [
{
root = package;
}
(mkIf (package.ssl) {
forceSSL = true;
enableACME = true;
})
];
};
}