diff --git a/lib/options.nix b/lib/options.nix
index 5cea99067aaba..d46dec6e41cac 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -141,7 +141,7 @@ rec {
docOption = rec {
loc = opt.loc;
name = showOption opt.loc;
- description = opt.description or (throw "Option `${name}' has no description.");
+ description = opt.description or (lib.warn "Option `${name}' has no description." "This option has no description.");
declarations = filter (x: x != unknownModule) opt.declarations;
internal = opt.internal or false;
visible = opt.visible or true;
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix
index 02b91773f5dad..4e0d486e94c88 100644
--- a/nixos/doc/manual/default.nix
+++ b/nixos/doc/manual/default.nix
@@ -327,6 +327,7 @@ in rec {
# Generate manpages.
mkdir -p $out/share/man
xsltproc --nonet \
+ --maxdepth 6000 \
--param man.output.in.separate.dir 1 \
--param man.output.base.dir "'$out/share/man/'" \
--param man.endnotes.are.numbered 0 \
diff --git a/nixos/doc/manual/release-notes/rl-1909.xml b/nixos/doc/manual/release-notes/rl-1909.xml
index baf08d70bfb01..f54592b6bf6c1 100644
--- a/nixos/doc/manual/release-notes/rl-1909.xml
+++ b/nixos/doc/manual/release-notes/rl-1909.xml
@@ -51,7 +51,17 @@
-
+
+ The module gained an option named
+ which makes the generated
+ configuration.nix
+ 5 manual page include all options from all NixOS modules
+ included in a given configuration.nix configuration file. Currently, it is
+ set to false by default as enabling it frequently prevents evaluation. But
+ the plan is to eventually have it set to true by default. Please set it to
+ true now in your configuration.nix and fix all the bugs
+ it uncovers.
+
diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix
index 5f05b037bdde3..77490ca3762a5 100644
--- a/nixos/lib/eval-config.nix
+++ b/nixos/lib/eval-config.nix
@@ -51,7 +51,7 @@ in rec {
# system configuration.
inherit (lib.evalModules {
inherit prefix check;
- modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ];
+ modules = baseModules ++ extraModules ++ [ pkgsModule ] ++ modules;
args = extraArgs;
specialArgs =
{ modulesPath = builtins.toString ../modules; } // specialArgs;
@@ -60,7 +60,7 @@ in rec {
# These are the extra arguments passed to every module. In
# particular, Nixpkgs is passed through the "pkgs" argument.
extraArgs = extraArgs_ // {
- inherit modules baseModules;
+ inherit baseModules extraModules modules;
};
inherit (config._module.args) pkgs;
diff --git a/nixos/modules/misc/documentation.nix b/nixos/modules/misc/documentation.nix
index 9b2e1235b7481..834ac0de91213 100644
--- a/nixos/modules/misc/documentation.nix
+++ b/nixos/modules/misc/documentation.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, baseModules, ... }:
+{ config, lib, pkgs, baseModules, extraModules, modules, ... }:
with lib;
@@ -6,6 +6,8 @@ let
cfg = config.documentation;
+ manualModules = baseModules ++ optionals cfg.nixos.includeAllModules (extraModules ++ modules);
+
/* For the purpose of generating docs, evaluate options with each derivation
in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}".
It isn't perfect, but it seems to cover a vast majority of use cases.
@@ -18,7 +20,7 @@ let
options =
let
scrubbedEval = evalModules {
- modules = [ { nixpkgs.localSystem = config.nixpkgs.localSystem; } ] ++ baseModules;
+ modules = [ { nixpkgs.localSystem = config.nixpkgs.localSystem; } ] ++ manualModules;
args = (config._module.args) // { modules = [ ]; };
specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; };
};
@@ -146,6 +148,17 @@ in
'';
};
+ nixos.includeAllModules = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether the generated NixOS's documentation should include documentation for all
+ the options from all the NixOS modules included in the current
+ configuration.nix. Disabling this will make the manual
+ generator to ignore options defined outside of baseModules.
+ '';
+ };
+
};
};