diff --git a/lib/options.nix b/lib/options.nix index 5d52f065af084..c7970d38e733f 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -185,7 +185,13 @@ rec { then true else opt.visible or true; readOnly = opt.readOnly or false; - type = opt.type.description or null; + type = + if opt.type.name == "unspecified" + then lib.warn + ("Option `${showOption loc}' defined in ${showFiles opt.declarations} has no type.\n" + +" Please specify a valid types from or use types.raw if there is no appropriate type.") + null + else opt.type.description or null; } // optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; } // optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; } diff --git a/nixos/doc/manual/development/option-declarations.section.md b/nixos/doc/manual/development/option-declarations.section.md index be56529992ab1..d2fde88c4522d 100644 --- a/nixos/doc/manual/development/option-declarations.section.md +++ b/nixos/doc/manual/development/option-declarations.section.md @@ -27,9 +27,8 @@ The function `mkOption` accepts the following arguments. `type` -: The type of the option (see [](#sec-option-types)). It may be - omitted, but that's not advisable since it may lead to errors that - are hard to diagnose. +: The type of the option (see [](#sec-option-types)). This + argument is mandatory. `default` diff --git a/nixos/doc/manual/from_md/development/option-declarations.section.xml b/nixos/doc/manual/from_md/development/option-declarations.section.xml index 2845e37659b1b..7954dee1d9c00 100644 --- a/nixos/doc/manual/from_md/development/option-declarations.section.xml +++ b/nixos/doc/manual/from_md/development/option-declarations.section.xml @@ -38,9 +38,8 @@ options = { The type of the option (see - ). It may be omitted, but - that’s not advisable since it may lead to errors that are hard - to diagnose. + ). This argument is + mandatory. diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix index cf6c9661dc1b0..ed2ab88835ff0 100644 --- a/nixos/modules/services/networking/nsd.nix +++ b/nixos/modules/services/networking/nsd.nix @@ -247,6 +247,7 @@ let children = mkOption { default = {}; + type = types.attrsOf types.unspecified; description = '' Children zones inherit all options of their parents. Attributes defined in a child will overwrite the ones of its parent. Only diff --git a/nixos/modules/services/networking/unbound.nix b/nixos/modules/services/networking/unbound.nix index f6e9634909241..87873c8c1e83b 100644 --- a/nixos/modules/services/networking/unbound.nix +++ b/nixos/modules/services/networking/unbound.nix @@ -62,6 +62,7 @@ in { }; stateDir = mkOption { + type = types.path; default = "/var/lib/unbound"; description = "Directory holding all state for unbound to run."; }; diff --git a/nixos/modules/services/networking/vsftpd.nix b/nixos/modules/services/networking/vsftpd.nix index 710c2d9ca17b6..d205302051e14 100644 --- a/nixos/modules/services/networking/vsftpd.nix +++ b/nixos/modules/services/networking/vsftpd.nix @@ -153,6 +153,7 @@ in userlist = mkOption { default = []; + type = types.listOf types.str; description = "See ."; }; diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index bdc46faa7fd0c..b3820a90ca42d 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -217,6 +217,24 @@ in session = mkOption { default = []; + type = with types; listOf (submodule ({ ... }: { + options = { + manage = mkOption { + description = "Whether this is a desktop or a window manager"; + type = enum [ "desktop" "window" ]; + }; + + name = mkOption { + description = "Name of this session"; + type = str; + }; + + start = mkOption { + description = "Commands to run to start this session"; + type = lines; + }; + }; + })); example = literalExpression '' [ { manage = "desktop"; diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index d147155d796c1..dde70dc5ab6a5 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -36,7 +36,7 @@ in boot.kernelPackages = mkOption { default = pkgs.linuxPackages; - type = types.unspecified // { merge = mergeEqualOption; }; + type = types.anything // { merge = mergeEqualOption; }; apply = kernelPackages: kernelPackages.extend (self: super: { kernel = super.kernel.override (originalArgs: { inherit randstructSeed; diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 409424a5b0f65..14eaf7596ec35 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -575,7 +575,7 @@ in else "gzip" ); defaultText = literalDocBook "zstd if the kernel supports it (5.9+), gzip if not"; - type = types.unspecified; # We don't have a function type... + type = types.anything; # We don't have a function type... description = '' The compressor to use on the initrd image. May be any of: