+17
-82
lib/modules.nix
+17
-82
lib/modules.nix
······-null = Disable type inferencing completely. Use 'types.unspecified' for every option without type definition.-"printUnspecified" = Try to infer type of option without type definition and print options for which no full type could be inferred.-"printAll" = Try to infer type of option without type definition and print all options without type definition.······(concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules);······throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'."···············(throw "Option `${showOption loc'}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");···-/* Function that tries to infer the type of an option from the default value of the option. */-else if isFunction def then [ "functionTo unspecified" (types.functionTo types.unspecified) true ]-let nestedType = if (length def > 0) && (all (x: (type (inferType' x)) == (type (inferType' (head def)))) def)-in [ "listOf ${doc nestedType}" (types.listOf (type nestedType)) (containsUnspecified nestedType) ]-nestedType = if (length list > 0) && (all (x: (type (inferType' x)) == (type (inferType' (head list)))) list)-in [ "attrsOf ${doc nestedType}" (types.attrsOf (type nestedType)) (containsUnspecified nestedType) ]-Please verify the inferred type and define the type explicitely in ${showFiles opt.declarations}!-else if printMode == "printUnspecified" && (containsUnspecified inferred) then builtins.trace (inferDoc inferred) (type inferred)-then inferredType mode /* Set to 'true' to see every type that is being inferred, not just those types that result in 'unspecified'. */-else if mode != "silent" then builtins.trace noInferDoc types.unspecified else types.unspecified;···-fixMergeModules = modules: args: evalModules { inherit args; modules = (modules ++ [{ _module.check = false; }]); };
+21
-124
lib/options.nix
+21
-124
lib/options.nix
·········else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}.";throw "The unique option `${showOption loc}' is defined multiple times, in ${showFiles (getFiles defs)}."···-in if ss != {} then optionAttrSetToDocList' opt.loc internalModuleConfig (ss internalModuleConfig) else [];-# TODO: Use "extractOptionAttrSet" instead of "optionAttrSetToDocList'" to reduce the code size.-hasDerivation = any (t: elem t opt.type.nestedTypes) ((map (x: x.typerep) (with types; [package packageSet])) ++ ["(nixpkgsConfig)"]);-maybeHiddenDerivation = any (t: elem t opt.type.nestedTypes) (map (x: x.typerep) (with types; [path]));-else throw "The attribute ${optionName}.example must be wrapped with 'literalExample' in ${concatStringsSep " and " decls}!")-else throw "The option ${optionName} requires a 'defaultText' attribute in ${concatStringsSep " and " decls}!"))-then (if (let eval = builtins.tryEval (findDerivation opt.default); in eval.success && !eval.value)-"The attribute ${optionName}.defaultText might not be necessary in ${concatStringsSep " and " decls}!"-"The attribute ${optionName}.defaultText is not used and can be removed in ${concatStringsSep " and " decls}!"-typeKeys = if toDoc then { type = opt.type.name or null; } else { type = opt.type.typerep; keys = opt.loc; };-in if ss != {} then { suboptions = (extractOptionAttrSet false [] internalModuleConfig (ss internalModuleConfig)); } else {};-in if ss != {} then extractOptionAttrSet true opt.loc internalModuleConfig (ss internalModuleConfig) else []-else if isAttrs x then any findDerivation (mapAttrsToList (_: v: v) (removeAttrs x ["_args"]))
+48
-169
lib/types.nix
+48
-169
lib/types.nix
·········-getSubOptionsPrefixed = if (isNull getSubOptionsPrefixed) then (prefix: getSubOptions) else getSubOptionsPrefixed;···list = builtins.trace "`types.list' is deprecated; use `types.listOf' instead" types.listOf;······throw "The option `${showOption loc}' does not have a string value, in ${showFiles (getFiles defs)}."throw "The option `${showOption loc}' is defined both null and not null, in ${showFiles (getFiles defs)}."-typerep = "(enum${concatMapStrings (x: "(${escape ["(" ")"] (builtins.toString x)})") values})";-filterVisible = filter (opt: (if opt ? visible then opt.visible else true) && (if opt ? internal then !opt.internal else true));-modules = opts' ++ internalModule ++ map (def: { _file = def.file; imports = [(coerce def.value)]; }) defs;-nestedTypes = concatMap (opt: opt.type.nestedTypes) (collect (lib.isType "option") (getSubOptions {}));name = /* builtins.trace "types.optionSet is deprecated; use types.submodule instead" */ "option set";-defaultValues = map (x: {...}:x) resultType.nestedTypes; # INFO: It seems as nix can't compare functions, yet.
-2
nixos/default.nix
-2
nixos/default.nix
+2
-4
nixos/doc/manual/default.nix
+2
-4
nixos/doc/manual/default.nix
······-optionsList = filter (opt: opt.visible && !opt.internal) (optionAttrSetToDocList internalModule options);
+2
-104
nixos/doc/manual/development/option-declarations.xml
+2
-104
nixos/doc/manual/development/option-declarations.xml
······-derives from <varname>package</varname>, <varname>packageSet</varname> or <varname>nixpkgsConfig-</varname>, and if and only if a <varname>default</varname> attribute is defined and if and only if-<para>The <varname>type</varname> attribute must be defined for every option declaration.</para>-NixOS ships the tool <varname>nixos-typecheck</varname> that can check an option declaration to:-<para>Enforce that an option declaration has a <varname>defaultText</varname> if and only if the-<varname>nixpkgsConfig</varname> and if a <varname>default</varname> attribute is defined.</para>-<para>Enforce that the value of the <varname>example</varname> attribute is wrapped with <varname>-<para>Warn if a <varname>defaultText</varname> is defined in an option declaration if the type of
+3
-12
nixos/lib/eval-config.nix
+3
-12
nixos/lib/eval-config.nix
······
-91
nixos/lib/typechecker.nix
-91
nixos/lib/typechecker.nix
···-internalModule = { _module = config._module; } // (if isNull inferenceMode then {} else { _module.typeInference = mkForce inferenceMode; });-optionsSpecs' = filter (opt: opt.visible && !opt.internal) (optionAttrSetToParseableSpecifications config._module eval.options);-else if builtins.isFunction x then throw "Found an unexpected <function> in ${key} declared in ${concatStringsSep " and " decls}."-(listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs null)))))-silent = listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs "silent"));-printAll = listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs "printAll"));-printUnspecified = listToAttrs (map (o: { name = o.name; value = removeAttrs o ["name" "visible" "internal"]; }) (optionsSpecs "printUnspecified"));
-1
nixos/modules/config/i18n.nix
-1
nixos/modules/config/i18n.nix
-1
nixos/modules/config/sysctl.nix
-1
nixos/modules/config/sysctl.nix
+2
-2
nixos/modules/installer/tools/nixos-option.sh
+2
-2
nixos/modules/installer/tools/nixos-option.sh
···
-52
nixos/modules/installer/tools/nixos-typecheck.sh
-52
nixos/modules/installer/tools/nixos-typecheck.sh
···-ln -s $(nix-build --no-out-link '<nixpkgs/nixos>' -A typechecker.specifications $extraArgs)/share/doc/nixos/options-specs.json specifications.json
+1
-7
nixos/modules/installer/tools/tools.nix
+1
-7
nixos/modules/installer/tools/tools.nix
······
-1
nixos/modules/misc/meta.nix
-1
nixos/modules/misc/meta.nix
+23
-26
nixos/modules/misc/nixpkgs.nix
+23
-26
nixos/modules/misc/nixpkgs.nix
······
-1
nixos/modules/module-list.nix
-1
nixos/modules/module-list.nix
-3
nixos/modules/services/misc/gitlab.nix
-3
nixos/modules/services/misc/gitlab.nix
···
-4
nixos/modules/services/misc/ihaskell.nix
-4
nixos/modules/services/misc/ihaskell.nix
······
+1
-4
nixos/modules/services/misc/nixos-manual.nix
+1
-4
nixos/modules/services/misc/nixos-manual.nix
·········
+2
-1
nixos/modules/services/web-servers/apache-httpd/default.nix
+2
-1
nixos/modules/services/web-servers/apache-httpd/default.nix
···else import (toString "${toString ./.}/${if svc ? serviceType then svc.serviceType else svc.serviceName}.nix");-{ modules = [ { options = res.options; config = svc.config or svc; } ] ++ [ { _module.check = false; } ];
-3
nixos/modules/services/x11/window-managers/xmonad.nix
-3
nixos/modules/services/x11/window-managers/xmonad.nix
······
-1
nixos/modules/system/boot/kernel.nix
-1
nixos/modules/system/boot/kernel.nix
+2
-3
nixos/modules/system/boot/systemd-unit-options.nix
+2
-3
nixos/modules/system/boot/systemd-unit-options.nix
···
-2
nixos/release.nix
-2
nixos/release.nix
···manpages = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manpages);options = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux;-optionsSpecs = (buildFromConfig ({ pkgs, ... }: { _module.typeInference = "silent"; }) (config: config.system.build.typechecker.specifications)).x86_64-linux;