From 0def73f39074f7a0699b8362a313e16abf291b31 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 23 Oct 2013 19:32:19 +0200 Subject: [PATCH] Manual: Don't depend on the absolute path of modules This ensures that the manual has the same store path regardless of the directory in which Nixpkgs is stored, and thus can be fetched from the channel. --- nixos/doc/manual/default.nix | 18 ++++++++++++++++-- nixos/doc/manual/options-to-docbook.xsl | 15 +++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 7aa59ffdf5d..52dda551f1e 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -7,9 +7,23 @@ with pkgs.lib; let - options' = filter (x: x.visible && !x.internal) (optionAttrSetToDocList options); + # Remove invisible and internal options. + options' = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options); - optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML options')); + # Clean up declaration sites to not refer to the NixOS source tree. + options'' = flip map options' (opt: opt // { + declarations = map (fn: stripPrefix fn) opt.declarations; + }); + + prefix = toString pkgs.path; + + stripPrefix = fn: + if substring 0 (stringLength prefix) fn == prefix then + substring (add (stringLength prefix) 1) 1000 fn + else + fn; + + optionsXML = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext (builtins.toXML options'')); optionsDocBook = pkgs.runCommand "options-db.xml" {} '' ${pkgs.libxslt}/bin/xsltproc \ diff --git a/nixos/doc/manual/options-to-docbook.xsl b/nixos/doc/manual/options-to-docbook.xsl index adc6c93c722..c799eecc0c1 100644 --- a/nixos/doc/manual/options-to-docbook.xsl +++ b/nixos/doc/manual/options-to-docbook.xsl @@ -155,8 +155,15 @@ repository (if it’s a module and we have a revision number), or to the local filesystem. --> - - https://github.com/NixOS/nixos/blob//modules/ + + + + https://github.com/NixOS/nixpkgs/blob/master/ + + + https://github.com/NixOS/nixpkgs/blob// + + https://github.com/NixOS/nixops/blob//nix/ @@ -169,8 +176,8 @@ /nix/store/ prefix by the default location of nixos sources. --> - - <nixos/modules/> + + <nixpkgs/> <nixops/>