2022-03-27 18:47:07 -07:00
|
|
|
{ blog-source, blog-source-localized, pkgs, katex-html }:
|
2021-10-21 23:00:13 -07:00
|
|
|
|
|
|
|
with pkgs;
|
2020-04-06 16:51:17 -07:00
|
|
|
|
|
|
|
let
|
2020-09-02 17:25:52 -07:00
|
|
|
website = settings: stdenv.mkDerivation {
|
2021-10-23 00:51:13 -07:00
|
|
|
inherit (settings) src ssl host;
|
2020-09-02 17:25:52 -07:00
|
|
|
name = "blog-static";
|
2021-10-23 00:51:13 -07:00
|
|
|
version = settings.src.rev;
|
2022-05-01 13:12:41 -07:00
|
|
|
postPatch = with settings.replaceUrl; ''
|
|
|
|
substituteInPlace config.toml --replace ${from} ${to}
|
|
|
|
'';
|
2020-09-02 17:25:52 -07:00
|
|
|
publicPath = settings.path;
|
2022-04-09 03:20:02 -07:00
|
|
|
extraFlags = (if settings.drafts then " -D " else "") + settings.extraFlags;
|
2021-10-21 22:39:25 -07:00
|
|
|
builder = ./build/builder.sh;
|
2020-12-14 19:16:27 -08:00
|
|
|
buildInputs = [
|
2022-03-27 21:51:18 -07:00
|
|
|
hugo katex-html
|
2020-12-14 19:16:27 -08:00
|
|
|
];
|
2020-09-02 17:25:52 -07:00
|
|
|
};
|
2021-10-23 00:51:13 -07:00
|
|
|
wrapHost = ssl: host: (if ssl then "https" else "http") + "://${host}";
|
2020-09-02 17:03:02 -07:00
|
|
|
in
|
2021-10-23 00:33:22 -07:00
|
|
|
{
|
2021-10-23 00:27:43 -07:00
|
|
|
english = settings: website {
|
2021-10-23 00:51:13 -07:00
|
|
|
inherit (settings) host;
|
2021-10-23 00:27:43 -07:00
|
|
|
ssl = settings.ssl or false;
|
2021-10-23 00:33:22 -07:00
|
|
|
drafts = settings.drafts or false;
|
2021-10-23 00:51:13 -07:00
|
|
|
src = blog-source;
|
2020-09-02 17:25:52 -07:00
|
|
|
path = ".";
|
2022-04-09 03:20:02 -07:00
|
|
|
extraFlags = "--config=config.toml,config-gen.toml";
|
2021-10-23 00:27:43 -07:00
|
|
|
replaceUrl = {
|
|
|
|
from = "https://danilafe.com";
|
2021-10-23 00:33:22 -07:00
|
|
|
to = wrapHost (settings.ssl or false) settings.host;
|
2020-09-02 17:25:52 -07:00
|
|
|
};
|
2021-10-23 00:27:43 -07:00
|
|
|
};
|
|
|
|
russian = settings: website {
|
2021-10-23 00:51:13 -07:00
|
|
|
inherit (settings) host;
|
2021-10-23 00:27:43 -07:00
|
|
|
ssl = settings.ssl or false;
|
2021-10-23 00:33:22 -07:00
|
|
|
drafts = settings.drafts or false;
|
2021-10-23 00:51:13 -07:00
|
|
|
src = blog-source-localized;
|
2021-10-23 00:27:43 -07:00
|
|
|
path = "ru";
|
2022-04-09 03:20:02 -07:00
|
|
|
extraFlags = "";
|
2021-10-23 00:27:43 -07:00
|
|
|
replaceUrl = {
|
|
|
|
from = "https://ru.danilafe.com";
|
2021-10-23 00:33:22 -07:00
|
|
|
to = wrapHost (settings.ssl or false) settings.host;
|
2020-09-02 17:25:52 -07:00
|
|
|
};
|
|
|
|
};
|
2021-10-23 00:33:22 -07:00
|
|
|
}
|