Reformat default.nix
This commit is contained in:
parent
8f8ebe68e0
commit
07f0596f6e
106
blog/default.nix
106
blog/default.nix
|
@ -1,58 +1,58 @@
|
||||||
{ stdenv, lib, hugo, fetchgit, pkgs, nodejs, ruby }:
|
{ stdenv, lib, hugo, fetchgit, pkgs, nodejs, ruby }:
|
||||||
|
|
||||||
let
|
let
|
||||||
url = "https://dev.danilafe.com/Web-Projects/blog-static.git";
|
url = "https://dev.danilafe.com/Web-Projects/blog-static.git";
|
||||||
requiredPackages = import ./required-packages.nix { inherit pkgs nodejs; };
|
requiredPackages = import ./required-packages.nix { inherit pkgs nodejs; };
|
||||||
website = settings: stdenv.mkDerivation {
|
website = settings: stdenv.mkDerivation {
|
||||||
name = "blog-static";
|
name = "blog-static";
|
||||||
version = settings.rev;
|
version = settings.rev;
|
||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
inherit url;
|
inherit url;
|
||||||
inherit (settings) rev sha256;
|
inherit (settings) rev sha256;
|
||||||
};
|
|
||||||
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;
|
|
||||||
buildInputs = [ hugo requiredPackages.katex (ruby.withPackages (ps: [ ps.nokogiri ])) ];
|
|
||||||
};
|
};
|
||||||
rev = "b921ddfc8de1282cc82a0d90b2927bf2a5c0ee68";
|
urlSub =
|
||||||
sha256 = "1gg7dq9y1hg14qjlj2w1rn0xjgqw58s8kpd5x6c0wfpwszcm87ji";
|
let
|
||||||
localizationRev = "cd574b43fdddf8b6777610f94897d70697533af9";
|
regexEscape = lib.escape [ "/" "(" ")" "[" "]" "+" "*" "\\" ];
|
||||||
localizationSha256 = "1lv65bllrc605lda5gqgpk4ihhg77qgh1zg60swsllmhh5vawgbn";
|
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;
|
||||||
|
buildInputs = [ hugo requiredPackages.katex (ruby.withPackages (ps: [ ps.nokogiri ])) ];
|
||||||
|
};
|
||||||
|
rev = "b921ddfc8de1282cc82a0d90b2927bf2a5c0ee68";
|
||||||
|
sha256 = "1gg7dq9y1hg14qjlj2w1rn0xjgqw58s8kpd5x6c0wfpwszcm87ji";
|
||||||
|
localizationRev = "cd574b43fdddf8b6777610f94897d70697533af9";
|
||||||
|
localizationSha256 = "1lv65bllrc605lda5gqgpk4ihhg77qgh1zg60swsllmhh5vawgbn";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
english = website {
|
english = website {
|
||||||
inherit rev sha256;
|
inherit rev sha256;
|
||||||
path = ".";
|
path = ".";
|
||||||
drafts = false;
|
drafts = false;
|
||||||
};
|
};
|
||||||
drafts = {
|
drafts = {
|
||||||
english = website {
|
english = website {
|
||||||
inherit rev sha256;
|
inherit rev sha256;
|
||||||
path = ".";
|
path = ".";
|
||||||
drafts = true;
|
drafts = true;
|
||||||
replaceUrl = {
|
replaceUrl = {
|
||||||
from = "https://danilafe.com";
|
from = "https://danilafe.com";
|
||||||
to = "http://drafts.danilafe.com";
|
to = "http://drafts.danilafe.com";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
russian = website {
|
russian = website {
|
||||||
rev = localizationRev;
|
rev = localizationRev;
|
||||||
sha256 = localizationSha256;
|
sha256 = localizationSha256;
|
||||||
path = "ru";
|
path = "ru";
|
||||||
drafts = true;
|
drafts = true;
|
||||||
replaceUrl = {
|
replaceUrl = {
|
||||||
from = "https://ru.danilafe.com";
|
from = "https://ru.danilafe.com";
|
||||||
to = "http://drafts.ru.danilafe.com";
|
to = "http://drafts.ru.danilafe.com";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user