summary refs log tree commit diff
path: root/nixos/modules/services/misc/nixos-manual.nix
diff options
context:
space:
mode:
authorThomas Strobel <ts468@cam.ac.uk>2016-02-20 01:47:01 +0100
committerThomas Strobel <ts468@cam.ac.uk>2016-02-29 01:09:00 +0100
commitcad8957eabcbf73062226d28366fd446c15c8737 (patch)
tree0299e96391c14f612e7bd1cf3b2274198425fd61 /nixos/modules/services/misc/nixos-manual.nix
parentc483224c82c8e94324c03576e64c5dfbf16bd2f8 (diff)
downloadnixlib-cad8957eabcbf73062226d28366fd446c15c8737.tar
nixlib-cad8957eabcbf73062226d28366fd446c15c8737.tar.gz
nixlib-cad8957eabcbf73062226d28366fd446c15c8737.tar.bz2
nixlib-cad8957eabcbf73062226d28366fd446c15c8737.tar.lz
nixlib-cad8957eabcbf73062226d28366fd446c15c8737.tar.xz
nixlib-cad8957eabcbf73062226d28366fd446c15c8737.tar.zst
nixlib-cad8957eabcbf73062226d28366fd446c15c8737.zip
Add the tool "nixos-typecheck" that can check an option declaration to:
 - Enforce that an option declaration has a "defaultText" if and only if the
   type of the option derives from "package", "packageSet" or "nixpkgsConfig"
   and if a "default" attribute is defined.

 - Enforce that the value of the "example" attribute is wrapped with "literalExample"
   if the type of the option derives from "package", "packageSet" or "nixpkgsConfig".

 - Warn if a "defaultText" is defined in an option declaration if the type of
   the option does not derive from "package", "packageSet" or "nixpkgsConfig".

 - Warn if no "type" is defined in an option declaration.
Diffstat (limited to 'nixos/modules/services/misc/nixos-manual.nix')
-rw-r--r--nixos/modules/services/misc/nixos-manual.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix
index 37ea339300d4..7ba1c319add4 100644
--- a/nixos/modules/services/misc/nixos-manual.nix
+++ b/nixos/modules/services/misc/nixos-manual.nix
@@ -17,6 +17,8 @@ let
       nixpkgs.system = config.nixpkgs.system;
     };
 
+  internalModule = { _module = config._module; };
+
   /* 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.
@@ -29,7 +31,7 @@ let
     options =
       let
         scrubbedEval = evalModules {
-          modules = [ versionModule ] ++ baseModules;
+          modules = [ versionModule ] ++ baseModules ++ [ internalModule ];
           args = (config._module.args) // { modules = [ ]; };
           specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; };
         };
@@ -43,6 +45,7 @@ let
           )
           pkgSet;
       in scrubbedEval.options;
+    internalModule = config._module;
   };
 
   entry = "${manual.manual}/share/doc/nixos/index.html";