From 8b79cc00bfbe9528b7bb752a4975849c3cdf982a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 17 Nov 2014 13:41:18 +0100 Subject: [PATCH] Manual: Don't depend on the JSON options --- nixos/doc/manual/default.nix | 48 ++++++++++++++++-------------------- nixos/release.nix | 2 +- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 68248081af6a..ea1d8ffc7de5 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -30,34 +30,13 @@ let else fn; - # Convert the list of options into an XML file and a JSON file. The builtin - # unsafeDiscardStringContext is used to prevent the realisation of the store - # paths which are used in options definitions. + # Convert the list of options into an XML file. The builtin + # unsafeDiscardStringContext is used to prevent the realisation of + # the store paths which are used in options definitions. 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" {} '' - optionsXML=${options'}/share/doc/nixos/options.xml + optionsXML=${optionsXML} if grep /nixpkgs/nixos/modules $optionsXML; then 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" @@ -83,8 +62,23 @@ let in rec { - # Tools-friendly version of the list of NixOS options. - options = options'; + # The NixOS options in JSON format. + 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. manual = stdenv.mkDerivation { diff --git a/nixos/release.nix b/nixos/release.nix index 472961c27d04..ddb0b495a91f 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -130,7 +130,7 @@ in rec { manual = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manual); manualPDF = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manualPDF)).x86_64-linux; 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.