diff options
author | Thomas Strobel <ts468@cam.ac.uk> | 2016-02-20 01:47:01 +0100 |
---|---|---|
committer | Thomas Strobel <ts468@cam.ac.uk> | 2016-02-29 01:09:00 +0100 |
commit | cad8957eabcbf73062226d28366fd446c15c8737 (patch) | |
tree | 0299e96391c14f612e7bd1cf3b2274198425fd61 /nixos/doc/manual/default.nix | |
parent | c483224c82c8e94324c03576e64c5dfbf16bd2f8 (diff) | |
download | nixlib-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/doc/manual/default.nix')
-rw-r--r-- | nixos/doc/manual/default.nix | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index 4ce6ea1c1118..ea8601497361 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -1,4 +1,4 @@ -{ pkgs, options, version, revision, extraSources ? [] }: +{ pkgs, options, internalModule, version, revision, extraSources ? [] }: with pkgs; with pkgs.lib; @@ -6,8 +6,10 @@ with pkgs.lib; let # Remove invisible and internal options. - optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList options); + optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList internalModule options); + # INFO: Please add 'defaultText' or 'literalExample' to the option + # definition to avoid this substitution! # Replace functions by the string <function> substFunction = x: if builtins.isAttrs x then mapAttrs (name: substFunction) x |