Try derive hosts from derivation, too
This commit is contained in:
17
lib.nix
17
lib.nix
@@ -5,17 +5,14 @@ with pkgs;
|
||||
let
|
||||
requiredPackages = import ./required-packages.nix { inherit pkgs nodejs; };
|
||||
website = settings: stdenv.mkDerivation {
|
||||
inherit (settings) src ssl host;
|
||||
name = "blog-static";
|
||||
version = settings.source.rev;
|
||||
src = settings.source;
|
||||
ssl = settings.ssl;
|
||||
version = settings.src.rev;
|
||||
urlSub =
|
||||
let
|
||||
regexEscape = lib.escape [ "/" "(" ")" "[" "]" "+" "*" "\\" ];
|
||||
in
|
||||
if (settings ? replaceUrl)
|
||||
then (with settings.replaceUrl; "s/${regexEscape from}/${regexEscape to}/g")
|
||||
else "";
|
||||
with settings.replaceUrl; "s/${regexEscape from}/${regexEscape to}/g";
|
||||
publicPath = settings.path;
|
||||
extraFlags = if settings.drafts then " -D " else "";
|
||||
builder = ./build/builder.sh;
|
||||
@@ -29,13 +26,14 @@ let
|
||||
(ruby.withPackages (ps: [ ps.nokogiri ]))
|
||||
];
|
||||
};
|
||||
wrapHost = ssl: host: (if ssl then "https" else "http") + "//${host}";
|
||||
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;
|
||||
source = blog-source;
|
||||
src = blog-source;
|
||||
path = ".";
|
||||
replaceUrl = {
|
||||
from = "https://danilafe.com";
|
||||
@@ -43,9 +41,10 @@ in
|
||||
};
|
||||
};
|
||||
russian = settings: website {
|
||||
inherit (settings) host;
|
||||
ssl = settings.ssl or false;
|
||||
drafts = settings.drafts or false;
|
||||
source = blog-source-localized;
|
||||
src = blog-source-localized;
|
||||
path = "ru";
|
||||
replaceUrl = {
|
||||
from = "https://ru.danilafe.com";
|
||||
|
||||
Reference in New Issue
Block a user