runCommand
Years ago I had a try at NixOs. I remembered that JGrahamC had a “docbook rocks” page up and I dug up the corresponding repository. It seems however that the nix files aren’t up to date (fair enough, repo is in archival mode) but I would like to adapt it.
See the default.nix: docbook.rocks/default.nix at ab1c85c52145d18d2cf12119cf2a56436f16e789 · grahamc/docbook.rocks · GitHub
I did adjust it a little to fix obvious name mismatches
{ runCommand, stdenv, lib, jing, libxslt, docbook5, docbook_xsl_ns,
libxml2, callPackage }:
let
documentation-highlighter = callPackage ./documentation-highlighter {};
manualXsltprocOptions = toString [
"--param section.autolabel 1"
"--param section.label.includes.component.label 1"
"--stringparam html.stylesheet style.css"
"--stringparam html.script './highlightjs/highlight.pack.js ./highlightjs/loader.js'"
"--param xref.with.number.and.title 1"
"--param toc.section.depth 3"
"--stringparam admon.style ''"
"--stringparam callout.graphics.extension .svg"
"--stringparam current.docid book-docbook-rocks"
#"--param chunk.first.sections 1"
#"--param use.id.as.filename 1"
"--param make.clean.html 1"
"--param suppress.navigation 1"
#"--stringparam generate.toc 'book chapter section'"
"--param id.warnings 1"
];
in stdenv.mkDerivation {
name = "docbook.rocks";
src = ./.;
buildInputs = [ jing libxslt libxml2 ];
installPhase = ''
jing ${docbook5}/xml/rng/docbook/docbook.rng $combined
# Generate the HTML manual.
dst=$out/
mkdir -p $dst
xmllint --xinclude --output ./combined.xml ./book.xml
xsltproc \
${manualXsltprocOptions} \
--nonet --output $dst/index.html \
${docbook_xsl_ns}/xml/xsl/docbook/xhtml/docbook.xsl \
./combined.xml
sed -i -e 's#</head>#<meta name="viewport" content="width=device-width, initial-scale=1" /></head>#' $out/index.html
mkdir -p $dst/images
cp -r ${docbook_xsl_ns}/xml/xsl/docbook/images/callouts $dst/images/callouts
cp ${./style.css} $dst/style.css
mkdir $dst/highlightjs/
cp ${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/loader.js \
$dst/highlightjs/
'';
}
But then I get an error of
% nix-build
error: cannot evaluate a function that has an argument without a value ('runCommand')
Nix attempted to evaluate a function as a top level expression; in
this case it must have its arguments supplied either by default
values, or passed explicitly with '--arg' or '--argstr'. See
https://nixos.org/manual/nix/stable/expressions/language-constructs.html#functions.
at /Users/holger/ext/docbook.rocks/default.nix:1:3:
1| { runCommand, stdenv, lib, jing, libxslt, docbook5, docbook_xsl_ns,
| ^
2| libxml2, callPackage }