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/>