{ blog-source, blog-source-localized, pkgs, katex-html }: with pkgs; let website = settings: stdenv.mkDerivation { inherit (settings) src ssl host; name = "blog-static"; version = settings.src.rev; urlSub = let regexEscape = lib.escape [ "/" "(" ")" "[" "]" "+" "*" "\\" ]; in with settings.replaceUrl; "s/${regexEscape from}/${regexEscape to}/g"; publicPath = settings.path; extraFlags = if settings.drafts then " -D " else ""; builder = ./build/builder.sh; buildInputs = [ hugo katex-html ]; }; wrapHost = ssl: host: (if ssl then "https" else "http") + "://${host}"; in { english = settings: website { inherit (settings) host; ssl = settings.ssl or false; drafts = settings.drafts or false; src = blog-source; path = "."; replaceUrl = { from = "https://danilafe.com"; to = wrapHost (settings.ssl or false) settings.host; }; }; russian = settings: website { inherit (settings) host; ssl = settings.ssl or false; drafts = settings.drafts or false; src = blog-source-localized; path = "ru"; replaceUrl = { from = "https://ru.danilafe.com"; to = wrapHost (settings.ssl or false) settings.host; }; }; }