Manual: Don't depend on the JSON options

This commit is contained in:
Eelco Dolstra 2014-11-17 13:41:18 +01:00
parent 0a34445d74
commit 8b79cc00bf
2 changed files with 22 additions and 28 deletions

View File

@ -30,34 +30,13 @@ let
else else
fn; fn;
# Convert the list of options into an XML file and a JSON file. The builtin # Convert the list of options into an XML file. The builtin
# unsafeDiscardStringContext is used to prevent the realisation of the store # unsafeDiscardStringContext is used to prevent the realisation of
# paths which are used in options definitions. # the store paths which are used in options definitions.
optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML optionsList')); optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML optionsList'));
optionsJSON = builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON optionsList'));
# Tools-friendly version of the list of NixOS options.
options' = stdenv.mkDerivation {
name = "options";
buildCommand = ''
# Export list of options in different format.
dst=$out/share/doc/nixos
mkdir -p $dst
cp ${optionsJSON} $dst/options.json
cp ${optionsXML} $dst/options.xml
mkdir -p $out/nix-support
echo "file json $dst/options.json" >> $out/nix-support/hydra-build-products
echo "file xml $dst/options.xml" >> $out/nix-support/hydra-build-products
''; # */
meta.description = "List of NixOS options in various formats.";
};
optionsDocBook = runCommand "options-db.xml" {} '' optionsDocBook = runCommand "options-db.xml" {} ''
optionsXML=${options'}/share/doc/nixos/options.xml optionsXML=${optionsXML}
if grep /nixpkgs/nixos/modules $optionsXML; then if grep /nixpkgs/nixos/modules $optionsXML; then
echo "The manual appears to depend on the location of Nixpkgs, which is bad" echo "The manual appears to depend on the location of Nixpkgs, which is bad"
echo "since this prevents sharing via the NixOS channel. This is typically" echo "since this prevents sharing via the NixOS channel. This is typically"
@ -83,8 +62,23 @@ let
in rec { in rec {
# Tools-friendly version of the list of NixOS options. # The NixOS options in JSON format.
options = options'; optionsJSON = stdenv.mkDerivation {
name = "options-json";
buildCommand = ''
# Export list of options in different format.
dst=$out/share/doc/nixos
mkdir -p $dst
cp ${builtins.toFile "options.json" (builtins.unsafeDiscardStringContext (builtins.toJSON optionsList'))} $dst/options.json
mkdir -p $out/nix-support
echo "file json $dst/options.json" >> $out/nix-support/hydra-build-products
''; # */
meta.description = "List of NixOS options in JSON format";
};
# Generate the NixOS manual. # Generate the NixOS manual.
manual = stdenv.mkDerivation { manual = stdenv.mkDerivation {

View File

@ -130,7 +130,7 @@ in rec {
manual = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manual); manual = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manual);
manualPDF = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manualPDF)).x86_64-linux; manualPDF = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manualPDF)).x86_64-linux;
manpages = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manpages); manpages = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manpages);
options = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.options)).x86_64-linux; options = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux;
# Build the initial ramdisk so Hydra can keep track of its size over time. # Build the initial ramdisk so Hydra can keep track of its size over time.