mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
37 lines
817 B
Nix
37 lines
817 B
Nix
{
|
|
lib,
|
|
asciidoctor,
|
|
stdenvNoCC,
|
|
self,
|
|
}: let
|
|
inherit (lib.strings) hasSuffix;
|
|
src = lib.cleanSourceWith {
|
|
name = "genso-docs-src";
|
|
src = ./.;
|
|
filter = path: type:
|
|
(hasSuffix ".adoc" path || baseNameOf path == "docinfo.html")
|
|
|| type == "directory";
|
|
};
|
|
in stdenvNoCC.mkDerivation {
|
|
pname = "genso-docs";
|
|
version = "dev";
|
|
inherit src;
|
|
|
|
ASCIIDOCTOR_OPTS = [
|
|
"-a" "docinfo=shared"
|
|
];
|
|
|
|
nativeBuildInputs = [ asciidoctor ];
|
|
passAsFile = [ "buildCommand" ];
|
|
buildCommand = ''
|
|
install -d "$out"
|
|
ASCIIDOCTOR_SRCS=(
|
|
$(find "$src" -type f -name '*.adoc' -not -path "$src/inc/*")
|
|
)
|
|
asciidoctor \
|
|
$ASCIIDOCTOR_OPTS \
|
|
-a docinfodir="$src/" \
|
|
-a inc="$src/_inc/" \
|
|
-b html -R "$src" -D "$out" "''${ASCIIDOCTOR_SRCS[@]}"
|
|
'';
|
|
}
|