3
0
Fork 0
forked from mirrors/nixpkgs

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.
This commit is contained in:
Eelco Dolstra 2013-10-23 19:32:19 +02:00
parent caf18545a4
commit 0def73f390
2 changed files with 27 additions and 6 deletions

View file

@ -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 \

View file

@ -155,8 +155,15 @@
repository (if its a module and we have a revision number),
or to the local filesystem. -->
<xsl:choose>
<xsl:when test="$revision != 'local' and contains(@value, '/modules/')">
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixos/blob/<xsl:value-of select="$revision"/>/modules/<xsl:value-of select="substring-after(@value, '/modules/')"/></xsl:attribute>
<xsl:when test="not(starts-with(@value, '/'))">
<xsl:choose>
<xsl:when test="$revision = 'local'">
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/master/<xsl:value-of select="@value"/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixpkgs/blob/<xsl:value-of select="$revision"/>/<xsl:value-of select="@value"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$revision != 'local' and contains(@value, 'nixops') and contains(@value, '/nix/')">
<xsl:attribute name="xlink:href">https://github.com/NixOS/nixops/blob/<xsl:value-of select="$revision"/>/nix/<xsl:value-of select="substring-after(@value, '/nix/')"/></xsl:attribute>
@ -169,8 +176,8 @@
/nix/store/<hash> prefix by the default location of nixos
sources. -->
<xsl:choose>
<xsl:when test="contains(@value, '/modules/')">
&lt;nixos/modules/<xsl:value-of select="substring-after(@value, '/modules/')"/>&gt;
<xsl:when test="not(starts-with(@value, '/'))">
&lt;nixpkgs/<xsl:value-of select="@value"/>&gt;
</xsl:when>
<xsl:when test="contains(@value, 'nixops') and contains(@value, '/nix/')">
&lt;nixops/<xsl:value-of select="substring-after(@value, '/nix/')"/>&gt;