Manual: Handle XML files in subdirectories

Changed files
+18 -14
lib
nixos
doc
manual
+3 -3
lib/sources.nix
···
# Get all files ending with the specified suffices from the given
-
# directory. E.g. `sourceFilesBySuffices ./dir [".xml" ".c"]'.
+
# directory or its descendants. E.g. `sourceFilesBySuffices ./dir
+
# [".xml" ".c"]'.
sourceFilesBySuffices = path: exts:
let filter = name: type:
let base = baseNameOf (toString name);
-
in type != "directory" && lib.any (ext: lib.hasSuffix ext base) exts;
+
in type == "directory" || lib.any (ext: lib.hasSuffix ext base) exts;
in builtins.filterSource filter path;
-
}
+15 -11
nixos/doc/manual/default.nix
···
-o $out ${./options-to-docbook.xsl} ${optionsXML}
'';
+
sources = sourceFilesBySuffices ./. [".xml"];
+
+
copySources =
+
''
+
cp -prd $sources/* . # */
+
ln -s ${optionsDocBook} options-db.xml
+
echo "${version}" > version
+
'';
+
in rec {
# Generate the NixOS manual.
manual = stdenv.mkDerivation {
name = "nixos-manual";
-
sources = sourceFilesBySuffices ./. [".xml"];
+
inherit sources;
buildInputs = [ libxml2 libxslt ];
···
'';
buildCommand = ''
-
ln -s $sources/*.xml . # */
-
ln -s ${optionsDocBook} options-db.xml
-
echo "${version}" > version
+
${copySources}
# Check the validity of the manual sources.
xmllint --noout --nonet --xinclude --noxincludenode \
···
manualPDF = stdenv.mkDerivation {
name = "nixos-manual-pdf";
-
sources = sourceFilesBySuffices ./. [".xml"];
+
inherit sources;
buildInputs = [ libxml2 libxslt dblatex tetex ];
···
# TeX needs a writable font cache.
export VARTEXFONTS=$TMPDIR/texfonts
-
ln -s $sources/*.xml . # */
-
ln -s ${optionsDocBook} options-db.xml
-
echo "${version}" > version
+
${copySources}
dst=$out/share/doc/nixos
mkdir -p $dst
···
manpages = stdenv.mkDerivation {
name = "nixos-manpages";
-
sources = sourceFilesBySuffices ./. [".xml"];
+
inherit sources;
buildInputs = [ libxml2 libxslt ];
buildCommand = ''
-
ln -s $sources/*.xml . # */
-
ln -s ${optionsDocBook} options-db.xml
+
${copySources}
# Check the validity of the manual sources.
xmllint --noout --nonet --xinclude --noxincludenode \