From cad8957eabcbf73062226d28366fd446c15c8737 Mon Sep 17 00:00:00 2001 From: Thomas Strobel Date: Sat, 20 Feb 2016 01:47:01 +0100 Subject: 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. --- nixos/doc/manual/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'nixos/doc/manual/default.nix') 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 substFunction = x: if builtins.isAttrs x then mapAttrs (name: substFunction) x -- cgit 1.4.1