diff --git a/doc/Makefile b/doc/Makefile index 5badfe4138d..4cd493d5565 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -21,7 +21,7 @@ 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 @@ -78,14 +78,14 @@ manual-full.xml: ${MD_TARGETS} .version functions/library/locations.xml function nix-instantiate --eval \ -E '(import ../lib).version' > .version -functions/library/locations.xml: - nix-build ./lib-function-locations.nix \ - --out-link $@ +doc-support/result: + (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 7ceaec28af3..7b44376034c 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"; @@ -30,9 +29,6 @@ in pkgs.stdenv.mkDerivation { ]; postPatch = '' - rm -rf ./functions/library/locations.xml - ln -s ${locationsXml} ./functions/library/locations.xml - ln -s ${functionDocs} ./functions/library/generated echo ${lib.version} > .version ''; diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix new file mode 100644 index 00000000000..93f6287d4b0 --- /dev/null +++ b/doc/doc-support/default.nix @@ -0,0 +1,14 @@ +{ pkgs ? (import ../.. {}), nixpkgs ? { }}: +let + locationsXml = import ./lib-function-locations.nix { inherit pkgs nixpkgs; }; + functionDocs = import ./lib-function-docs.nix { inherit locationsXml pkgs; }; +in pkgs.runCommand "doc-support" {} +'' + mkdir result + ( + cd result + ln -s ${locationsXml} ./function-locations.xml + ln -s ${functionDocs} ./function-docs + ) + 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 421f848d25a..5199b949e7b 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