From 59f8b1e844d679d1ae7d2a94cf02f9ca259f0dfa Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 27 Apr 2018 22:44:25 -0400 Subject: [PATCH 1/4] nixos docs: Move generated XML in to a specific subdirectory to allow easier hacking --- nixos/doc/manual/configuration/configuration.xml | 3 +-- nixos/doc/manual/default.nix | 11 ++++++++--- nixos/doc/manual/man-configuration.xml | 2 +- nixos/doc/manual/manual.xml | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/nixos/doc/manual/configuration/configuration.xml b/nixos/doc/manual/configuration/configuration.xml index 8677c13db40f..f092c7e207ff 100644 --- a/nixos/doc/manual/configuration/configuration.xml +++ b/nixos/doc/manual/configuration/configuration.xml @@ -25,9 +25,8 @@ effect after you run nixos-rebuild. - + - diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index ac22712baf87..c396c799c638 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -102,13 +102,18 @@ let ''; + generatedSources = runCommand "generated-docbook" {} '' + mkdir $out + ln -s ${modulesDoc} $out/modules.xml + ln -s ${optionsDocBook} $out/options-db.xml + printf "%s" "${version}" > $out/version + ''; + copySources = '' cp -prd $sources/* . # */ + ln -s ${generatedSources} ./generated chmod -R u+w . - ln -s ${modulesDoc} configuration/modules.xml - ln -s ${optionsDocBook} options-db.xml - printf "%s" "${version}" > version ''; toc = builtins.toFile "toc.xml" diff --git a/nixos/doc/manual/man-configuration.xml b/nixos/doc/manual/man-configuration.xml index 05531b3909a3..89d321d69726 100644 --- a/nixos/doc/manual/man-configuration.xml +++ b/nixos/doc/manual/man-configuration.xml @@ -31,7 +31,7 @@ therein. You can use the following options in configuration.nix. - + diff --git a/nixos/doc/manual/manual.xml b/nixos/doc/manual/manual.xml index 9aa332f026da..a7825579e03d 100644 --- a/nixos/doc/manual/manual.xml +++ b/nixos/doc/manual/manual.xml @@ -6,7 +6,7 @@ NixOS Manual - Version + Version @@ -39,7 +39,7 @@ Configuration Options - + From 0ff0d138e4e9d68853c463a540d61718aa91cffb Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 28 Apr 2018 04:00:55 -0400 Subject: [PATCH 2/4] nixos docs: Add a makefile for hacking on the nixos docs --- nixos/doc/manual/Makefile | 8 ++++++++ nixos/doc/manual/default.nix | 1 + nixos/doc/manual/manual.xml | 3 ++- nixos/doc/manual/options-to-docbook.xsl | 8 ++++---- nixos/release.nix | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 nixos/doc/manual/Makefile diff --git a/nixos/doc/manual/Makefile b/nixos/doc/manual/Makefile new file mode 100644 index 000000000000..b15fbaa270fc --- /dev/null +++ b/nixos/doc/manual/Makefile @@ -0,0 +1,8 @@ +debug: + nix-shell --packages xmloscopy \ + --run 'xmloscopy --docbook5 ./manual.xml ./manual-combined.xml' + +generated: ./options-to-docbook.xsl + nix-build ../../release.nix \ + --attr manualGeneratedSources.x86_64-linux \ + --out-link ./generated diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index c396c799c638..2c6309474b37 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -229,6 +229,7 @@ let ''; in rec { + inherit generatedSources; # The NixOS options in JSON format. optionsJSON = runCommand "options-json" diff --git a/nixos/doc/manual/manual.xml b/nixos/doc/manual/manual.xml index a7825579e03d..676924e5c8b2 100644 --- a/nixos/doc/manual/manual.xml +++ b/nixos/doc/manual/manual.xml @@ -39,7 +39,8 @@ Configuration Options - + diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index 7b45b233ab2a..43a69806a2b0 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -15,9 +15,9 @@ - - - + + Configuration Options + @@ -100,7 +100,7 @@ - + diff --git a/nixos/release.nix b/nixos/release.nix index 2f779280e6b2..4994cd98302f 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -124,7 +124,6 @@ let preferLocalBuild = true; }; - in rec { channel = import lib/make-channel.nix { inherit pkgs nixpkgs version versionSuffix; }; @@ -132,6 +131,7 @@ in rec { manual = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manual); manualEpub = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manualEpub)); manpages = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manpages); + manualGeneratedSources = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.generatedSources); options = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux; From a77dc213a7825f5dd13c7989e38d82e64816d881 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 28 Apr 2018 04:04:56 -0400 Subject: [PATCH 3/4] nixos manual: update xi:include for configuruation.nix's options-db --- nixos/doc/manual/man-configuration.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/man-configuration.xml b/nixos/doc/manual/man-configuration.xml index 89d321d69726..37ffb9d648a9 100644 --- a/nixos/doc/manual/man-configuration.xml +++ b/nixos/doc/manual/man-configuration.xml @@ -31,7 +31,8 @@ therein. You can use the following options in configuration.nix. - + From 74fcb1c770e3a5178a7ee089b3caf406f7bf94bf Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Sat, 28 Apr 2018 04:15:16 -0400 Subject: [PATCH 4/4] nixos docs: include note about make for debugging the nixos docs --- .../development/writing-documentation.xml | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/nixos/doc/manual/development/writing-documentation.xml b/nixos/doc/manual/development/writing-documentation.xml index 59a287717acb..8b787fae1fe0 100644 --- a/nixos/doc/manual/development/writing-documentation.xml +++ b/nixos/doc/manual/development/writing-documentation.xml @@ -18,13 +18,25 @@ The DocBook sources of the are in the nixos/doc/manual - subdirectory of the Nixpkgs repository. If you make modifications to - the manual, it's important to build it before committing. You can do - that as follows: - - nix-build nixos/release.nix -A manual.x86_64-linux + subdirectory of the Nixpkgs repository. + + You can quickly validate your edits with make: + + + + $ cd /path/to/nixpkgs/nixos/doc/manual + $ make + + + + Once you are done making modifications to the manual, it's important + to build it before committing. You can do that as follows: + + +nix-build nixos/release.nix -A manual.x86_64-linux + When this command successfully finishes, it will tell you where the manual got generated. The HTML will be accessible through the