diff --git a/doc/Makefile b/doc/Makefile
index 5badfe4138d4..e7ca31b20d71 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -8,10 +8,10 @@ debug:
nix-shell --run "xmloscopy --docbook5 ./manual.xml ./manual-full.xml"
.PHONY: format
-format:
+format: doc-support/result
find . -iname '*.xml' -type f | while read f; do \
echo $$f ;\
- xmlformat --config-file "$$XMLFORMAT_CONFIG" -i $$f ;\
+ xmlformat --config-file "doc-support/result/xmlformat.conf" -i $$f ;\
done
.PHONY: fix-misc-xml
@@ -21,19 +21,19 @@ fix-misc-xml:
.PHONY: clean
clean:
- rm -f ${MD_TARGETS} .version manual-full.xml functions/library/locations.xml functions/library/generated
+ rm -f ${MD_TARGETS} doc-support/result .version manual-full.xml functions/library/locations.xml functions/library/generated
rm -rf ./out/ ./highlightjs
.PHONY: validate
-validate: manual-full.xml
- jing "$$RNG" manual-full.xml
+validate: manual-full.xml doc-support/result
+ jing doc-support/result/docbook.rng manual-full.xml
-out/html/index.html: manual-full.xml style.css highlightjs
+out/html/index.html: doc-support/result manual-full.xml style.css highlightjs
mkdir -p out/html
- xsltproc ${xsltFlags} \
+ xsltproc \
--nonet --xinclude \
--output $@ \
- "$$XSL/docbook/xhtml/docbook.xsl" \
+ doc-support/result/xhtml.xsl \
./manual-full.xml
mkdir -p out/html/highlightjs/
@@ -43,49 +43,48 @@ out/html/index.html: manual-full.xml style.css highlightjs
cp ./style.css out/html/style.css
mkdir -p out/html/images/callouts
- cp "$$XSL/docbook/images/callouts/"*.svg out/html/images/callouts/
+ cp doc-support/result/xsl/docbook/images/callouts/*.svg out/html/images/callouts/
chmod u+w -R out/html/
out/epub/manual.epub: manual-full.xml
mkdir -p out/epub/scratch
- xsltproc ${xsltFlags} --nonet \
+ xsltproc --nonet \
--output out/epub/scratch/ \
- "$$XSL/docbook/epub/docbook.xsl" \
+ doc-support/result/epub.xsl \
./manual-full.xml
cp ./overrides.css out/epub/scratch/OEBPS
cp ./style.css out/epub/scratch/OEBPS
mkdir -p out/epub/scratch/OEBPS/images/callouts/
- cp "$$XSL/docbook/images/callouts/"*.svg out/epub/scratch/OEBPS/images/callouts/
+ cp doc-support/result/xsl/docbook/images/callouts/*.svg out/epub/scratch/OEBPS/images/callouts/
echo "application/epub+zip" > mimetype
zip -0Xq "out/epub/manual.epub" mimetype
rm mimetype
cd "out/epub/scratch/" && zip -Xr9D "../manual.epub" *
rm -rf "out/epub/scratch/"
-highlightjs:
+highlightjs: doc-support/result
mkdir -p highlightjs
- cp -r "$$HIGHLIGHTJS/highlight.pack.js" highlightjs/
- cp -r "$$HIGHLIGHTJS/LICENSE" highlightjs/
- cp -r "$$HIGHLIGHTJS/mono-blue.css" highlightjs/
- cp -r "$$HIGHLIGHTJS/loader.js" highlightjs/
+ cp -r doc-support/result/highlightjs/highlight.pack.js highlightjs/
+ cp -r doc-support/result/highlightjs/LICENSE highlightjs/
+ cp -r doc-support/result/highlightjs/mono-blue.css highlightjs/
+ cp -r doc-support/result/highlightjs/loader.js highlightjs/
manual-full.xml: ${MD_TARGETS} .version functions/library/locations.xml functions/library/generated *.xml **/*.xml **/**/*.xml
xmllint --nonet --xinclude --noxincludenode manual.xml --output manual-full.xml
-.version:
- nix-instantiate --eval \
- -E '(import ../lib).version' > .version
+.version: doc-support/result
+ ln -rfs ./doc-support/result/version .version
-functions/library/locations.xml:
- nix-build ./lib-function-locations.nix \
- --out-link $@
+doc-support/result: doc-support/default.nix
+ (cd doc-support; nix-build)
-functions/library/generated: functions/library/locations.xml
- nix-build ./lib-function-docs.nix \
- --arg locationsXml $< \
- --out-link $@
+functions/library/locations.xml: doc-support/result
+ ln -rfs ./doc-support/result/function-locations.xml functions/library/locations.xml
+
+functions/library/generated: doc-support/result
+ ln -rfs ./doc-support/result/function-docs functions/library/generated
%.section.xml: %.section.md
pandoc $^ -w docbook+smart \
diff --git a/doc/default.nix b/doc/default.nix
index 7ceaec28af38..d9051167dee5 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -1,8 +1,7 @@
{ pkgs ? (import ./.. { }), nixpkgs ? { }}:
let
lib = pkgs.lib;
- locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; };
- functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; };
+ doc-support = import ./doc-support { inherit pkgs nixpkgs; };
in pkgs.stdenv.mkDerivation {
name = "nixpkgs-manual";
@@ -10,30 +9,8 @@ in pkgs.stdenv.mkDerivation {
src = ./.;
- # Hacking on these variables? Make sure to close and open
- # nix-shell between each test, maybe even:
- # $ nix-shell --run "make clean all"
- # otherwise they won't reapply :)
- HIGHLIGHTJS = pkgs.documentation-highlighter;
- XSL = "${pkgs.docbook_xsl_ns}/xml/xsl";
- RNG = "${pkgs.docbook5}/xml/rng/docbook/docbook.rng";
- XMLFORMAT_CONFIG = ../nixos/doc/xmlformat.conf;
- xsltFlags = lib.concatStringsSep " " [
- "--param section.autolabel 1"
- "--param section.label.includes.component.label 1"
- "--stringparam html.stylesheet 'style.css overrides.css highlightjs/mono-blue.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"
- ];
-
postPatch = ''
- rm -rf ./functions/library/locations.xml
- ln -s ${locationsXml} ./functions/library/locations.xml
- ln -s ${functionDocs} ./functions/library/generated
- echo ${lib.version} > .version
+ ln -s ${doc-support} ./doc-support/result
'';
installPhase = ''
diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix
new file mode 100644
index 000000000000..53990b677196
--- /dev/null
+++ b/doc/doc-support/default.nix
@@ -0,0 +1,45 @@
+{ pkgs ? (import ../.. {}), nixpkgs ? { }}:
+let
+ locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; };
+ functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; };
+ version = pkgs.lib.version;
+
+ epub-xsl = pkgs.writeText "epub.xsl" ''
+
+
+
+
+
+ '';
+
+ xhtml-xsl = pkgs.writeText "xhtml.xsl" ''
+
+
+
+
+
+ '';
+in pkgs.runCommand "doc-support" {}
+''
+ mkdir result
+ (
+ cd result
+ ln -s ${locationsXml} ./function-locations.xml
+ ln -s ${functionDocs} ./function-docs
+
+ ln -s ${pkgs.docbook5}/xml/rng/docbook/docbook.rng ./docbook.rng
+ ln -s ${pkgs.docbook_xsl_ns}/xml/xsl ./xsl
+ ln -s ${epub-xsl} ./epub.xsl
+ ln -s ${xhtml-xsl} ./xhtml.xsl
+
+ ln -s ${../../nixos/doc/xmlformat.conf} ./xmlformat.conf
+ ln -s ${pkgs.documentation-highlighter} ./highlightjs
+
+ echo -n "${version}" > ./version
+ )
+ mv result $out
+''
diff --git a/doc/lib-function-docs.nix b/doc/doc-support/lib-function-docs.nix
similarity index 97%
rename from doc/lib-function-docs.nix
rename to doc/doc-support/lib-function-docs.nix
index 421f848d25ab..5199b949e7b8 100644
--- a/doc/lib-function-docs.nix
+++ b/doc/doc-support/lib-function-docs.nix
@@ -6,7 +6,7 @@
with pkgs; stdenv.mkDerivation {
name = "nixpkgs-lib-docs";
- src = ./../lib;
+ src = ./../../lib;
buildInputs = [ nixdoc ];
installPhase = ''
diff --git a/doc/lib-function-locations.nix b/doc/doc-support/lib-function-locations.nix
similarity index 100%
rename from doc/lib-function-locations.nix
rename to doc/doc-support/lib-function-locations.nix
diff --git a/doc/doc-support/parameters.xml b/doc/doc-support/parameters.xml
new file mode 100644
index 000000000000..bc13e2b70dec
--- /dev/null
+++ b/doc/doc-support/parameters.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+