mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-19 20:09:01 +02:00
nixos/documentation: avoid top-level with ...;
in nixos/modules/misc/documentation.nix
This commit is contained in:
parent
c60f0f6863
commit
58f791c765
|
@ -1,8 +1,32 @@
|
||||||
{ config, options, lib, pkgs, utils, modules, baseModules, extraModules, modulesPath, specialArgs, ... }:
|
{ config, options, lib, pkgs, utils, modules, baseModules, extraModules, modulesPath, specialArgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (lib)
|
||||||
|
cleanSourceFilter
|
||||||
|
concatMapStringsSep
|
||||||
|
evalModules
|
||||||
|
filter
|
||||||
|
functionArgs
|
||||||
|
hasSuffix
|
||||||
|
isAttrs
|
||||||
|
isDerivation
|
||||||
|
isFunction
|
||||||
|
isPath
|
||||||
|
literalExpression
|
||||||
|
mapAttrs
|
||||||
|
mkIf
|
||||||
|
mkMerge
|
||||||
|
mkOption
|
||||||
|
mkRemovedOptionModule
|
||||||
|
mkRenamedOptionModule
|
||||||
|
optional
|
||||||
|
optionalAttrs
|
||||||
|
optionals
|
||||||
|
partition
|
||||||
|
removePrefix
|
||||||
|
types
|
||||||
|
warn
|
||||||
|
;
|
||||||
|
|
||||||
cfg = config.documentation;
|
cfg = config.documentation;
|
||||||
allOpts = options;
|
allOpts = options;
|
||||||
|
@ -13,7 +37,7 @@ let
|
||||||
instance = f (mapAttrs (n: _: abort "evaluating ${n} for `meta` failed") (functionArgs f));
|
instance = f (mapAttrs (n: _: abort "evaluating ${n} for `meta` failed") (functionArgs f));
|
||||||
in
|
in
|
||||||
cfg.nixos.options.splitBuild
|
cfg.nixos.options.splitBuild
|
||||||
&& builtins.isPath m
|
&& isPath m
|
||||||
&& isFunction f
|
&& isFunction f
|
||||||
&& instance ? options
|
&& instance ? options
|
||||||
&& instance.meta.buildDocsInSandbox or true;
|
&& instance.meta.buildDocsInSandbox or true;
|
||||||
|
@ -51,12 +75,12 @@ let
|
||||||
(name: value:
|
(name: value:
|
||||||
let
|
let
|
||||||
wholeName = "${namePrefix}.${name}";
|
wholeName = "${namePrefix}.${name}";
|
||||||
guard = lib.warn "Attempt to evaluate package ${wholeName} in option documentation; this is not supported and will eventually be an error. Use `mkPackageOption{,MD}` or `literalExpression` instead.";
|
guard = warn "Attempt to evaluate package ${wholeName} in option documentation; this is not supported and will eventually be an error. Use `mkPackageOption{,MD}` or `literalExpression` instead.";
|
||||||
in if isAttrs value then
|
in if isAttrs value then
|
||||||
scrubDerivations wholeName value
|
scrubDerivations wholeName value
|
||||||
// optionalAttrs (isDerivation value) {
|
// optionalAttrs (isDerivation value) {
|
||||||
outPath = guard "\${${wholeName}}";
|
outPath = guard "\${${wholeName}}";
|
||||||
drvPath = guard drvPath;
|
drvPath = guard value.drvPath;
|
||||||
}
|
}
|
||||||
else value
|
else value
|
||||||
)
|
)
|
||||||
|
@ -176,7 +200,7 @@ in
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Whether to install documentation of packages from
|
Whether to install documentation of packages from
|
||||||
{option}`environment.systemPackages` into the generated system path.
|
{option}`environment.systemPackages` into the generated system path.
|
||||||
|
|
||||||
|
@ -188,7 +212,7 @@ in
|
||||||
man.enable = mkOption {
|
man.enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Whether to install manual pages.
|
Whether to install manual pages.
|
||||||
This also includes `man` outputs.
|
This also includes `man` outputs.
|
||||||
'';
|
'';
|
||||||
|
@ -197,7 +221,7 @@ in
|
||||||
man.generateCaches = mkOption {
|
man.generateCaches = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = mdDoc ''
|
description = ''
|
||||||
Whether to generate the manual page index caches.
|
Whether to generate the manual page index caches.
|
||||||
This allows searching for a page or
|
This allows searching for a page or
|
||||||
keyword using utilities like {manpage}`apropos(1)`
|
keyword using utilities like {manpage}`apropos(1)`
|
||||||
|
@ -209,7 +233,7 @@ in
|
||||||
info.enable = mkOption {
|
info.enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Whether to install info pages and the {command}`info` command.
|
Whether to install info pages and the {command}`info` command.
|
||||||
This also includes "info" outputs.
|
This also includes "info" outputs.
|
||||||
'';
|
'';
|
||||||
|
@ -218,7 +242,7 @@ in
|
||||||
doc.enable = mkOption {
|
doc.enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Whether to install documentation distributed in packages' `/share/doc`.
|
Whether to install documentation distributed in packages' `/share/doc`.
|
||||||
Usually plain text and/or HTML.
|
Usually plain text and/or HTML.
|
||||||
This also includes "doc" outputs.
|
This also includes "doc" outputs.
|
||||||
|
@ -228,7 +252,7 @@ in
|
||||||
dev.enable = mkOption {
|
dev.enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = mdDoc ''
|
description = ''
|
||||||
Whether to install documentation targeted at developers.
|
Whether to install documentation targeted at developers.
|
||||||
* This includes man pages targeted at developers if {option}`documentation.man.enable` is
|
* This includes man pages targeted at developers if {option}`documentation.man.enable` is
|
||||||
set (this also includes "devman" outputs).
|
set (this also includes "devman" outputs).
|
||||||
|
@ -242,7 +266,7 @@ in
|
||||||
nixos.enable = mkOption {
|
nixos.enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Whether to install NixOS's own documentation.
|
Whether to install NixOS's own documentation.
|
||||||
|
|
||||||
- This includes man pages like
|
- This includes man pages like
|
||||||
|
@ -256,7 +280,7 @@ in
|
||||||
nixos.extraModules = mkOption {
|
nixos.extraModules = mkOption {
|
||||||
type = types.listOf types.raw;
|
type = types.listOf types.raw;
|
||||||
default = [];
|
default = [];
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Modules for which to show options even when not imported.
|
Modules for which to show options even when not imported.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -264,7 +288,7 @@ in
|
||||||
nixos.options.splitBuild = mkOption {
|
nixos.options.splitBuild = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Whether to split the option docs build into a cacheable and an uncacheable part.
|
Whether to split the option docs build into a cacheable and an uncacheable part.
|
||||||
Splitting the build can substantially decrease the amount of time needed to build
|
Splitting the build can substantially decrease the amount of time needed to build
|
||||||
the manual, but some user modules may be incompatible with this splitting.
|
the manual, but some user modules may be incompatible with this splitting.
|
||||||
|
@ -274,7 +298,7 @@ in
|
||||||
nixos.options.warningsAreErrors = mkOption {
|
nixos.options.warningsAreErrors = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Treat warning emitted during the option documentation build (eg for missing option
|
Treat warning emitted during the option documentation build (eg for missing option
|
||||||
descriptions) as errors.
|
descriptions) as errors.
|
||||||
'';
|
'';
|
||||||
|
@ -283,7 +307,7 @@ in
|
||||||
nixos.includeAllModules = mkOption {
|
nixos.includeAllModules = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Whether the generated NixOS's documentation should include documentation for all
|
Whether the generated NixOS's documentation should include documentation for all
|
||||||
the options from all the NixOS modules included in the current
|
the options from all the NixOS modules included in the current
|
||||||
`configuration.nix`. Disabling this will make the manual
|
`configuration.nix`. Disabling this will make the manual
|
||||||
|
@ -294,7 +318,7 @@ in
|
||||||
nixos.extraModuleSources = mkOption {
|
nixos.extraModuleSources = mkOption {
|
||||||
type = types.listOf (types.either types.path types.str);
|
type = types.listOf (types.either types.path types.str);
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = lib.mdDoc ''
|
description = ''
|
||||||
Which extra NixOS module paths the generated NixOS's documentation should strip
|
Which extra NixOS module paths the generated NixOS's documentation should strip
|
||||||
from options.
|
from options.
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue