mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
doc: avoid top-level with ...;
in nixos/doc/manual/default.nix
This commit is contained in:
parent
8b1d5260c4
commit
c60f0f6863
|
@ -9,12 +9,20 @@
|
||||||
, prefix ? ../../..
|
, prefix ? ../../..
|
||||||
}:
|
}:
|
||||||
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) hasPrefix removePrefix;
|
inherit (pkgs) buildPackages runCommand docbook_xsl_ns;
|
||||||
|
|
||||||
lib = pkgs.lib;
|
inherit (pkgs.lib)
|
||||||
|
hasPrefix
|
||||||
|
removePrefix
|
||||||
|
flip
|
||||||
|
foldr
|
||||||
|
types
|
||||||
|
mkOption
|
||||||
|
escapeShellArg
|
||||||
|
concatMapStringsSep
|
||||||
|
sourceFilesBySuffices
|
||||||
|
;
|
||||||
|
|
||||||
common = import ./common.nix;
|
common = import ./common.nix;
|
||||||
|
|
||||||
|
@ -27,7 +35,7 @@ let
|
||||||
# E.g. if some `options` came from modules in ${pkgs.customModules}/nix,
|
# E.g. if some `options` came from modules in ${pkgs.customModules}/nix,
|
||||||
# you'd need to include `extraSources = [ pkgs.customModules ]`
|
# you'd need to include `extraSources = [ pkgs.customModules ]`
|
||||||
prefixesToStrip = map (p: "${toString p}/") ([ prefix ] ++ extraSources);
|
prefixesToStrip = map (p: "${toString p}/") ([ prefix ] ++ extraSources);
|
||||||
stripAnyPrefixes = lib.flip (lib.foldr lib.removePrefix) prefixesToStrip;
|
stripAnyPrefixes = flip (foldr removePrefix) prefixesToStrip;
|
||||||
|
|
||||||
optionsDoc = buildPackages.nixosOptionsDoc {
|
optionsDoc = buildPackages.nixosOptionsDoc {
|
||||||
inherit options revision baseOptionsJSON warningsAreErrors;
|
inherit options revision baseOptionsJSON warningsAreErrors;
|
||||||
|
@ -42,8 +50,8 @@ let
|
||||||
testOptionsDoc = let
|
testOptionsDoc = let
|
||||||
eval = nixos-lib.evalTest {
|
eval = nixos-lib.evalTest {
|
||||||
# Avoid evaluating a NixOS config prototype.
|
# Avoid evaluating a NixOS config prototype.
|
||||||
config.node.type = lib.types.deferredModule;
|
config.node.type = types.deferredModule;
|
||||||
options._module.args = lib.mkOption { internal = true; };
|
options._module.args = mkOption { internal = true; };
|
||||||
};
|
};
|
||||||
in buildPackages.nixosOptionsDoc {
|
in buildPackages.nixosOptionsDoc {
|
||||||
inherit (eval) options;
|
inherit (eval) options;
|
||||||
|
@ -76,7 +84,7 @@ let
|
||||||
substituteInPlace ./configuration/configuration.md \
|
substituteInPlace ./configuration/configuration.md \
|
||||||
--replace \
|
--replace \
|
||||||
'@MODULE_CHAPTERS@' \
|
'@MODULE_CHAPTERS@' \
|
||||||
${lib.escapeShellArg (lib.concatMapStringsSep "\n" (p: "${p.value}") config.meta.doc)}
|
${escapeShellArg (concatMapStringsSep "\n" (p: "${p.value}") config.meta.doc)}
|
||||||
substituteInPlace ./nixos-options.md \
|
substituteInPlace ./nixos-options.md \
|
||||||
--replace \
|
--replace \
|
||||||
'@NIXOS_OPTIONS_JSON@' \
|
'@NIXOS_OPTIONS_JSON@' \
|
||||||
|
@ -95,7 +103,7 @@ in rec {
|
||||||
# Generate the NixOS manual.
|
# Generate the NixOS manual.
|
||||||
manualHTML = runCommand "nixos-manual-html"
|
manualHTML = runCommand "nixos-manual-html"
|
||||||
{ nativeBuildInputs = [ buildPackages.nixos-render-docs ];
|
{ nativeBuildInputs = [ buildPackages.nixos-render-docs ];
|
||||||
inputs = lib.sourceFilesBySuffices ./. [ ".md" ];
|
inputs = sourceFilesBySuffices ./. [ ".md" ];
|
||||||
meta.description = "The NixOS manual in HTML format";
|
meta.description = "The NixOS manual in HTML format";
|
||||||
allowedReferences = ["out"];
|
allowedReferences = ["out"];
|
||||||
}
|
}
|
||||||
|
@ -114,8 +122,8 @@ in rec {
|
||||||
|
|
||||||
nixos-render-docs -j $NIX_BUILD_CORES manual html \
|
nixos-render-docs -j $NIX_BUILD_CORES manual html \
|
||||||
--manpage-urls ${manpageUrls} \
|
--manpage-urls ${manpageUrls} \
|
||||||
--revision ${lib.escapeShellArg revision} \
|
--revision ${escapeShellArg revision} \
|
||||||
--generator "nixos-render-docs ${lib.version}" \
|
--generator "nixos-render-docs ${pkgs.lib.version}" \
|
||||||
--stylesheet style.css \
|
--stylesheet style.css \
|
||||||
--stylesheet highlightjs/mono-blue.css \
|
--stylesheet highlightjs/mono-blue.css \
|
||||||
--script ./highlightjs/highlight.pack.js \
|
--script ./highlightjs/highlight.pack.js \
|
||||||
|
@ -147,7 +155,7 @@ in rec {
|
||||||
xml:id="book-nixos-manual">
|
xml:id="book-nixos-manual">
|
||||||
<info>
|
<info>
|
||||||
<title>NixOS Manual</title>
|
<title>NixOS Manual</title>
|
||||||
<subtitle>Version ${lib.version}</subtitle>
|
<subtitle>Version ${pkgs.lib.version}</subtitle>
|
||||||
</info>
|
</info>
|
||||||
<chapter>
|
<chapter>
|
||||||
<title>Temporarily unavailable</title>
|
<title>Temporarily unavailable</title>
|
||||||
|
@ -199,7 +207,7 @@ in rec {
|
||||||
# Generate manpages.
|
# Generate manpages.
|
||||||
mkdir -p $out/share/man/man5
|
mkdir -p $out/share/man/man5
|
||||||
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
nixos-render-docs -j $NIX_BUILD_CORES options manpage \
|
||||||
--revision ${lib.escapeShellArg revision} \
|
--revision ${escapeShellArg revision} \
|
||||||
${optionsJSON}/${common.outputPath}/options.json \
|
${optionsJSON}/${common.outputPath}/options.json \
|
||||||
$out/share/man/man5/configuration.nix.5
|
$out/share/man/man5/configuration.nix.5
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue