Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 <nixpkgs/lib/types.nix> 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; }
Expand Down
5 changes: 2 additions & 3 deletions nixos/doc/manual/development/option-declarations.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ options = {
<listitem>
<para>
The type of the option (see
<xref linkend="sec-option-types" />). It may be omitted, but
that’s not advisable since it may lead to errors that are hard
to diagnose.
<xref linkend="sec-option-types" />). This argument is
mandatory.
</para>
</listitem>
</varlistentry>
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/services/networking/nsd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/services/networking/unbound.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ in {
};

stateDir = mkOption {
type = types.path;
default = "/var/lib/unbound";
description = "Directory holding all state for unbound to run.";
};
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/services/networking/vsftpd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ in

userlist = mkOption {
default = [];
type = types.listOf types.str;
description = "See <option>userlistFile</option>.";
};

Expand Down
18 changes: 18 additions & 0 deletions nixos/modules/services/x11/display-managers/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/system/boot/kernel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/system/boot/stage-1.nix
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ in
else "gzip"
);
defaultText = literalDocBook "<literal>zstd</literal> if the kernel supports it (5.9+), <literal>gzip</literal> 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:

Expand Down