diff --git a/doc/contributing/reviewing-contributions.chapter.md b/doc/contributing/reviewing-contributions.chapter.md
index 0a90781d0c59e..b78fda6c28825 100644
--- a/doc/contributing/reviewing-contributions.chapter.md
+++ b/doc/contributing/reviewing-contributions.chapter.md
@@ -122,7 +122,7 @@ Reviewing process:
- [CODEOWNERS](https://help.github.com/articles/about-codeowners/) will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
- Ensure that the module tests, if any, are succeeding.
- Ensure that the introduced options are correct.
- - Type should be appropriate (string related types differs in their merging capabilities, `optionSet` and `string` types are deprecated).
+ - Type should be appropriate (string related types differs in their merging capabilities, `loaOf` and `string` types are deprecated).
- Description, default and example should be provided.
- Ensure that option changes are backward compatible.
- `mkRenamedOptionModule` and `mkAliasOptionModule` functions provide way to make option changes backward compatible.
@@ -157,7 +157,7 @@ Reviewing process:
- Ensure that the module tests, if any, are succeeding.
- Ensure that the introduced options are correct.
- - Type should be appropriate (string related types differs in their merging capabilities, `optionSet` and `string` types are deprecated).
+ - Type should be appropriate (string related types differs in their merging capabilities, `loaOf` and `string` types are deprecated).
- Description, default and example should be provided.
- Ensure that module `meta` field is present
- Maintainers should be declared in `meta.maintainers`.
diff --git a/lib/modules.nix b/lib/modules.nix
index 01ba914ca80ef..735cb3c967ac2 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -609,17 +609,9 @@ rec {
throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
else
let
- /* Add the modules of the current option to the list of modules
- already collected. The options attribute except either a list of
- submodules or a submodule. For each submodule, we add the file of the
- current option declaration as the file use for the submodule. If the
- submodule defines any filename, then we ignore the enclosing option file. */
- options' = toList opt.options.options;
-
getSubModules = opt.options.type.getSubModules or null;
submodules =
if getSubModules != null then map (setDefaultModuleLocation opt._file) getSubModules ++ res.options
- else if opt.options ? options then map (coerceOption opt._file) options' ++ res.options
else res.options;
in opt.options // res //
{ declarations = res.declarations ++ [opt._file];
@@ -802,27 +794,13 @@ rec {
compare = a: b: (a.priority or 1000) < (b.priority or 1000);
in sort compare defs';
+ # This calls substSubModules, whose entire purpose is only to ensure that
+ # option declarations in submodules have accurate position information.
+ # TODO: Merge this into mergeOptionDecls
fixupOptionType = loc: opt:
- let
- options = opt.options or
- (throw "Option `${showOption loc}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");
-
- # Hack for backward compatibility: convert options of type
- # optionSet to options of type submodule. FIXME: remove
- # eventually.
- f = tp:
- 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 (tp.functor.wrapped.name or null) == "optionSet" then
- if tp.name == "attrsOf" then types.attrsOf (types.submodule options)
- else if tp.name == "listOf" then types.listOf (types.submodule options)
- else if tp.name == "nullOr" then types.nullOr (types.submodule options)
- else tp
- else tp;
- in
- if opt.type.getSubModules or null == null
- then opt // { type = f (opt.type or types.unspecified); }
- else opt // { type = opt.type.substSubModules opt.options; options = []; };
+ if opt.type.getSubModules or null == null
+ then opt // { type = opt.type or types.unspecified; }
+ else opt // { type = opt.type.substSubModules opt.options; options = []; };
/* Properties. */
diff --git a/lib/options.nix b/lib/options.nix
index 9efc1249e58e9..8d0801775c462 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -79,8 +79,6 @@ rec {
visible ? null,
# Whether the option can be set only once
readOnly ? null,
- # Deprecated, used by types.optionSet.
- options ? null
} @ attrs:
attrs // { _type = "option"; };
diff --git a/lib/types.nix b/lib/types.nix
index 00d97bf572372..5c4b963106178 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -749,14 +749,6 @@ rec {
nestedTypes.finalType = finalType;
};
- # Obsolete alternative to configOf. It takes its option
- # declarations from the ‘options’ attribute of containing option
- # declaration.
- optionSet = mkOptionType {
- name = "optionSet";
- description = "option set";
- deprecationMessage = "Use `types.submodule' instead";
- };
# Augment the given type with an additional type check function.
addCheck = elemType: check: elemType // { check = x: elemType.check x && check x; };
diff --git a/pkgs/test/mkOption/declare.nix b/pkgs/test/mkOption/declare.nix
deleted file mode 100644
index 9e89a1c096da5..0000000000000
--- a/pkgs/test/mkOption/declare.nix
+++ /dev/null
@@ -1,53 +0,0 @@
-# sets of small configurations:
-# Each configuration
-rec {
- # has 2 arguments pkgs and this.
- configA = pkgs: this: {
- # Can depends on other configuration
- require = configB;
-
- # Defines new options
- optionA = pkgs.lib.mkOption {
- # With default values
- default = false;
- # And merging functions.
- merge = pkgs.lib.mergeEnableOption;
- };
-
- # Add a new definition to other options.
- optionB = this.optionA;
- };
-
- # Can be used for option header.
- configB = pkgs: this: {
- # Can depends on more than one configuration.
- require = [ configC configD ];
-
- optionB = pkgs.lib.mkOption {
- default = false;
- };
-
- # Is not obliged to define other options.
- };
-
- configC = pkgs: this: {
- require = [ configA ];
-
- optionC = pkgs.lib.mkOption {
- default = false;
- };
-
- # Use the default value if it is not overwritten.
- optionA = this.optionC;
- };
-
- # Can also be used as option configuration only.
- # without any arguments (backward compatibility)
- configD = {
- # Is not forced to specify the require attribute.
-
- # Is not force to make new options.
- optionA = true;
- optionD = false;
- };
-}
diff --git a/pkgs/test/mkOption/keep.nix b/pkgs/test/mkOption/keep.nix
deleted file mode 100644
index 26fb8c28dd593..0000000000000
--- a/pkgs/test/mkOption/keep.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-let
- pkgs = import ../../.. {};
- config = import ./declare.nix;
-in
- with (pkgs.lib);
-
- finalReferenceOptionSets
- filterOptionSets
- pkgs
- # List of main configurations.
- [ config.configB config.configC ]
diff --git a/pkgs/test/mkOption/keep.ref b/pkgs/test/mkOption/keep.ref
deleted file mode 100644
index a3a051eb48c4a..0000000000000
--- a/pkgs/test/mkOption/keep.ref
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pkgs/test/mkOption/merge.nix b/pkgs/test/mkOption/merge.nix
deleted file mode 100644
index bbf68218aa09a..0000000000000
--- a/pkgs/test/mkOption/merge.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-let
- pkgs = import ../../.. {};
- config = import ./declare.nix;
-
- # Define the handler of unbound options.
- noOption = name: values:
- builtins.trace "Attribute named '${name}' does not match any option declaration." values;
-in
- with (pkgs.lib);
-
- finalReferenceOptionSets
- (mergeOptionSets noOption)
- pkgs
- # List of main configurations.
- [ config.configB config.configC ]
diff --git a/pkgs/test/mkOption/merge.ref b/pkgs/test/mkOption/merge.ref
deleted file mode 100644
index 6956f65dbbcc4..0000000000000
--- a/pkgs/test/mkOption/merge.ref
+++ /dev/null
@@ -1,20 +0,0 @@
-trace: Str("Attribute named 'optionD' does not match any option declaration.",[])
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pkgs/test/mkOption/test.sh b/pkgs/test/mkOption/test.sh
deleted file mode 100755
index 5478846d563fb..0000000000000
--- a/pkgs/test/mkOption/test.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh -e
-
-echo 1>&2 "Test: Merge of option bindings."
-nix-instantiate merge.nix --eval-only --strict --xml >& merge.out
-diff merge.ref merge.out
-
-echo 1>&2 "Test: Filter of option declarations."
-nix-instantiate keep.nix --eval-only --strict --xml >& keep.out
-diff keep.ref keep.out