@@ -17,16 +17,32 @@ let
1717 nixpkgs.system = config.nixpkgs.system;
1818 };
1919
20− eval = evalModules {
21− modules = [ versionModule ] ++ baseModules;
22− args = (config._module.args) // { modules = [ ]; };
23− };
24−
20+ /* For the purpose of generating docs, evaluate options with each derivation
21+ in `pkgs` (recursively) replaced by a fake with path "\${pkgs.attribute.path}".
22+ It isn't perfect, but it seems to cover a vast majority of use cases.
23+ Caveat: even if the package is reached by a different means,
24+ the path above will be shown and not e.g. `${config.services.foo.package}`. */
2525 manual = import ../../../doc/manual {
2626 inherit pkgs;
2727 version = config.system.nixosVersion;
2828 revision = config.system.nixosRevision;
29− options = eval.options;
29+ options =
30+ let
31+ scrubbedEval = evalModules {
32+ modules = [ versionModule ] ++ baseModules;
33+ args = (config._module.args) // { modules = [ ]; };
34+ specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; };
35+ };
36+ scrubDerivations = namePrefix: pkgSet: mapAttrs
37+ (name: value:
38+ let wholeName = "${namePrefix}.${name}"; in
39+ if isAttrs value then
40+ scrubDerivations wholeName value
41+ // (optionalAttrs (isDerivation value) { outPath = "\${${wholeName}}"; })
42+ else value
43+ )
44+ pkgSet;
45+ in scrubbedEval.options;
3046 };
3147
3248 entry = "${manual.manual}/share/doc/nixos/index.html";
@@ -81,6 +97,7 @@ in
8197
8298 services.nixosManual.browser = mkOption {
8399 type = types.path;
100+ default = "${pkgs.w3m-nox}/bin/w3m";
84101 description = ''
85102 Browser used to show the manual.
86103 '';
@@ -118,8 +135,6 @@ in
118135 services.mingetty.helpLine = mkIf cfg.showManual
119136 "\nPress <Alt-F${toString cfg.ttyNumber}> for the NixOS manual.";
120137
121− services.nixosManual.browser = mkDefault "${pkgs.w3m-nox}/bin/w3m";
122−
123138 };
124139
125140}