2020-09-02 17:03:02 -07:00
|
|
|
{ stdenv, lib, hugo, fetchgit, pkgs, nodejs, ruby }:
|
2020-04-06 16:51:17 -07:00
|
|
|
|
|
|
|
let
|
2020-09-02 17:25:52 -07:00
|
|
|
url = "https://dev.danilafe.com/Web-Projects/blog-static.git";
|
|
|
|
requiredPackages = import ./required-packages.nix { inherit pkgs nodejs; };
|
|
|
|
website = settings: stdenv.mkDerivation {
|
|
|
|
name = "blog-static";
|
|
|
|
version = settings.rev;
|
|
|
|
src = fetchgit {
|
|
|
|
inherit url;
|
|
|
|
inherit (settings) rev sha256;
|
2021-01-01 21:39:08 -08:00
|
|
|
fetchSubmodules = true;
|
2020-09-02 17:03:02 -07:00
|
|
|
};
|
2020-09-02 17:25:52 -07:00
|
|
|
urlSub =
|
|
|
|
let
|
|
|
|
regexEscape = lib.escape [ "/" "(" ")" "[" "]" "+" "*" "\\" ];
|
|
|
|
in
|
|
|
|
if (settings ? replaceUrl)
|
|
|
|
then (with settings.replaceUrl; "s/${regexEscape from}/${regexEscape to}/g")
|
|
|
|
else "";
|
|
|
|
publicPath = settings.path;
|
|
|
|
extraFlags = if settings.drafts then " -D " else "";
|
|
|
|
builder = ./builder.sh;
|
|
|
|
converter = ./convert.rb;
|
2020-12-14 19:16:27 -08:00
|
|
|
server = ./katexserver.js;
|
|
|
|
buildInputs = [
|
2020-12-14 20:05:29 -08:00
|
|
|
hugo nodejs
|
2020-12-14 20:48:03 -08:00
|
|
|
requiredPackages."katex-0.11.1" requiredPackages.express requiredPackages.body-parser
|
2020-12-14 19:16:27 -08:00
|
|
|
(ruby.withPackages (ps: [ ps.nokogiri ]))
|
|
|
|
];
|
2020-09-02 17:25:52 -07:00
|
|
|
};
|
2021-01-01 21:39:08 -08:00
|
|
|
rev = "43dfee56cc59a8fec62ea98407e96cf38db8b036";
|
2021-01-01 21:41:56 -08:00
|
|
|
sha256 = "1wbxwp1zb9il8l5pcc006zpk3ha0qjxqp8mlz3r18qbsliqy1jjh";
|
2020-12-14 19:17:39 -08:00
|
|
|
localizationRev = "0b5748cc5a19b5d1d78bfcfa58d4027cc10524dd";
|
|
|
|
localizationSha256 = "12pqh534z3ppvgzy0a77s9j1qzzmiyxwvlmh5y76pccf32wvi9wz";
|
2020-09-02 17:03:02 -07:00
|
|
|
in
|
2020-09-02 17:25:52 -07:00
|
|
|
{
|
|
|
|
english = website {
|
|
|
|
inherit rev sha256;
|
|
|
|
path = ".";
|
|
|
|
drafts = false;
|
|
|
|
};
|
|
|
|
drafts = {
|
|
|
|
english = website {
|
|
|
|
inherit rev sha256;
|
|
|
|
path = ".";
|
|
|
|
drafts = true;
|
|
|
|
replaceUrl = {
|
|
|
|
from = "https://danilafe.com";
|
|
|
|
to = "http://drafts.danilafe.com";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
russian = website {
|
|
|
|
rev = localizationRev;
|
|
|
|
sha256 = localizationSha256;
|
|
|
|
path = "ru";
|
|
|
|
drafts = true;
|
|
|
|
replaceUrl = {
|
|
|
|
from = "https://ru.danilafe.com";
|
|
|
|
to = "http://drafts.ru.danilafe.com";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|