diff --git a/lib/modules.nix b/lib/modules.nix
index cd031839e649..5c9d66d8f97b 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -364,7 +364,6 @@ rec {
values = defs''';
inherit (defs'') highestPrio;
};
-
defsFinal = defsFinal'.values;
# Type-check the remaining definitions, and merge them.
@@ -477,22 +476,8 @@ rec {
optionSet to options of type submodule. FIXME: remove
eventually. */
fixupOptionType = loc: opt:
- let
- options = opt.options or
- (throw "Option `${showOption loc'}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");
- f = tp:
- let optionSetIn = type: (tp.name == type) && (tp.functor.wrapped.name == "optionSet");
- in
- if tp.name == "option set" || tp.name == "submodule" then
- throw "The option ${showOption loc} uses submodules without a wrapping type, in ${showFiles opt.declarations}."
- else if optionSetIn "attrsOf" then types.attrsOf (types.submodule options)
- else if optionSetIn "loaOf" then types.loaOf (types.submodule options)
- else if optionSetIn "listOf" then types.listOf (types.submodule options)
- else if optionSetIn "nullOr" then types.nullOr (types.submodule options)
- else tp;
- in
- if opt.type.getSubModules or null == null
- then opt // { type = f (opt.type or types.unspecified); }
+ if opt.type.getSubModules or null == null
+ then opt // { type = opt.type or types.unspecified; }
else opt // { type = opt.type.substSubModules opt.options; options = []; };
diff --git a/lib/options.nix b/lib/options.nix
index 791930eafbd0..5cea99067aab 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -48,8 +48,6 @@ rec {
visible ? null,
# Whether the option can be set only once
readOnly ? null,
- # Obsolete, used by types.optionSet.
- options ? null
} @ attrs:
attrs // { _type = "option"; };
diff --git a/lib/types.nix b/lib/types.nix
index 2ec8fd987c1a..7a88e1b9e36b 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -469,10 +469,7 @@ rec {
# Obsolete alternative to configOf. It takes its option
# declarations from the ‘options’ attribute of containing option
# declaration.
- optionSet = mkOptionType {
- name = builtins.trace "types.optionSet is deprecated; use types.submodule instead" "optionSet";
- description = "option set";
- };
+ optionSet = builtins.throw "types.optionSet is deprecated; use types.submodule instead" "optionSet";
# Augment the given type with an additional type check function.
addCheck = elemType: check: elemType // { check = x: elemType.check x && check x; };
diff --git a/nixos/doc/manual/release-notes/rl-1903.xml b/nixos/doc/manual/release-notes/rl-1903.xml
index ed62c51ce9b6..a48d238a4434 100644
--- a/nixos/doc/manual/release-notes/rl-1903.xml
+++ b/nixos/doc/manual/release-notes/rl-1903.xml
@@ -358,6 +358,14 @@
for details.
+
+
+ Support for NixOS module system type types.optionSet and
+ lib.mkOption argument options is removed.
+ Use types.submodule instead.
+ (#54637)
+
+
diff --git a/nixos/modules/profiles/minimal.nix b/nixos/modules/profiles/minimal.nix
index 809bedc588f2..f044e6f39ea5 100644
--- a/nixos/modules/profiles/minimal.nix
+++ b/nixos/modules/profiles/minimal.nix
@@ -13,5 +13,5 @@ with lib;
documentation.enable = mkDefault false;
- services.nixosManual.enable = mkDefault false;
+ documentation.nixos.enable = mkDefault false;
}
diff --git a/nixos/modules/services/networking/nylon.nix b/nixos/modules/services/networking/nylon.nix
index 613b0e0fb51a..b061ce34ed2c 100644
--- a/nixos/modules/services/networking/nylon.nix
+++ b/nixos/modules/services/networking/nylon.nix
@@ -142,7 +142,6 @@ in
description = "Collection of named nylon instances";
type = with types; loaOf (submodule nylonOpts);
internal = true;
- options = [ nylonOpts ];
};
};
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix
index 90d08ca31316..95dc8a62a454 100644
--- a/nixos/modules/services/networking/ssh/sshd.nix
+++ b/nixos/modules/services/networking/ssh/sshd.nix
@@ -11,7 +11,7 @@ let
userOptions = {
- openssh.authorizedKeys = {
+ options.openssh.authorizedKeys = {
keys = mkOption {
type = types.listOf types.str;
default = [];
@@ -320,7 +320,7 @@ in
};
users.users = mkOption {
- options = [ userOptions ];
+ type = with types; loaOf (submodule userOptions);
};
};
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index c8ea1401528c..5e27b24ac447 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -525,16 +525,18 @@ in
};
fileSystems = mkOption {
- options.neededForBoot = mkOption {
- default = false;
- type = types.bool;
- description = ''
- If set, this file system will be mounted in the initial
- ramdisk. By default, this applies to the root file system
- and to the file system containing
- /nix/store.
- '';
- };
+ type = with lib.types; loaOf (submodule {
+ options.neededForBoot = mkOption {
+ default = false;
+ type = types.bool;
+ description = ''
+ If set, this file system will be mounted in the initial
+ ramdisk. By default, this applies to the root file system
+ and to the file system containing
+ /nix/store.
+ '';
+ };
+ });
};
};
diff --git a/nixos/modules/tasks/encrypted-devices.nix b/nixos/modules/tasks/encrypted-devices.nix
index 11ed5d7e4d0c..2ffbb8777068 100644
--- a/nixos/modules/tasks/encrypted-devices.nix
+++ b/nixos/modules/tasks/encrypted-devices.nix
@@ -12,28 +12,28 @@ let
encryptedFSOptions = {
- encrypted = {
+ options.encrypted = {
enable = mkOption {
default = false;
type = types.bool;
description = "The block device is backed by an encrypted one, adds this device as a initrd luks entry.";
};
- blkDev = mkOption {
+ options.blkDev = mkOption {
default = null;
example = "/dev/sda1";
type = types.nullOr types.str;
description = "Location of the backing encrypted device.";
};
- label = mkOption {
+ options.label = mkOption {
default = null;
example = "rootfs";
type = types.nullOr types.str;
description = "Label of the unlocked encrypted device. Set fileSystems.<name?>.device to /dev/mapper/<label> to mount the unlocked device.";
};
- keyFile = mkOption {
+ options.keyFile = mkOption {
default = null;
example = "/mnt-root/root/.swapkey";
type = types.nullOr types.str;
@@ -47,10 +47,10 @@ in
options = {
fileSystems = mkOption {
- options = [encryptedFSOptions];
+ type = with lib.types; loaOf (submodule encryptedFSOptions);
};
swapDevices = mkOption {
- options = [encryptedFSOptions];
+ type = with lib.types; listOf (submodule encryptedFSOptions);
};
};
diff --git a/nixos/modules/testing/service-runner.nix b/nixos/modules/testing/service-runner.nix
index 5ead75788e5c..17d5e3376908 100644
--- a/nixos/modules/testing/service-runner.nix
+++ b/nixos/modules/testing/service-runner.nix
@@ -92,23 +92,24 @@ let
exit($mainRes & 127 ? 255 : $mainRes << 8);
'';
+ opts = { config, name, ... }: {
+ options.runner = mkOption {
+ internal = true;
+ description = ''
+ A script that runs the service outside of systemd,
+ useful for testing or for using NixOS services outside
+ of NixOS.
+ '';
+ };
+ config.runner = makeScript name config;
+ };
+
in
{
options = {
systemd.services = mkOption {
- options =
- { config, name, ... }:
- { options.runner = mkOption {
- internal = true;
- description = ''
- A script that runs the service outside of systemd,
- useful for testing or for using NixOS services outside
- of NixOS.
- '';
- };
- config.runner = makeScript name config;
- };
+ type = with types; attrsOf (submodule opts);
};
};
}