Welcome to my first post, built with spoonful!
This is a static site generator written in Nix. Pretty cool, right?
nix
spoonful.mkSite (lib: {
inherit lib;
static = ./static;
posts = builtins.sort lib.sorting.byDate (lib.importPosts ./content);
templates = lib.importTemplates ./templates;
metadata = {
title = "My Blog";
description = "A blog.";
link = "http://127.0.0.1:9999";
};
});Also, I replaced pandoc with asciidoctor, so I can use adoc instead of md, which I’m very happy with. It is very hacky indeed…
Here’s the code for that:
nix
mkHTML = pkgs.callPackage (
{
stdenv,
asciidoctor,
lua5_4,
lpeg,
source ? "",
}:
let
input = if builtins.isString source then pkgs.writeText "input.html" source else source;
in
stdenv.mkDerivation {
name = "html";
phases = [
"buildPhase"
"installPhase"
];
buildInputs = [
asciidoctor
lua5_4
lpeg
];
LUA_PATH = "${scintillua}/lexers/?.lua;;";
buildPhase = ''
asciidoctor ${pkgs.lib.concatStringsSep " " asciidoctorArgs} -s -o raw.html ${input}
lua ${./lua/codeblock.lua} raw.html > page.html
'';
installPhase = ''
mkdir $out
cp page.html $out/
'';
}
) { lpeg = pkgs.lua54Packages.lpeg; };