mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
lib/modules: Finally remove deprecated types.optionSet
types.optionSet has been deprecated for almost 10 years now (0e333688ce
)! A removal was already attempted in 2019 (27982b408e
), but it was promptly reinstantiated since some third-party uses were discovered (f531ce75e4178c6867cc1d0f7fec96b2d5c3f1cb). It's finally time to remove it for good :)
This commit is contained in:
parent
6cc306ec23
commit
96698efe0c
|
@ -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.
|
- [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 module tests, if any, are succeeding.
|
||||||
- Ensure that the introduced options are correct.
|
- 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.
|
- Description, default and example should be provided.
|
||||||
- Ensure that option changes are backward compatible.
|
- Ensure that option changes are backward compatible.
|
||||||
- `mkRenamedOptionModule` and `mkAliasOptionModule` functions provide way to make option changes 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 module tests, if any, are succeeding.
|
||||||
- Ensure that the introduced options are correct.
|
- 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.
|
- Description, default and example should be provided.
|
||||||
- Ensure that module `meta` field is present
|
- Ensure that module `meta` field is present
|
||||||
- Maintainers should be declared in `meta.maintainers`.
|
- Maintainers should be declared in `meta.maintainers`.
|
||||||
|
|
|
@ -609,17 +609,9 @@ rec {
|
||||||
throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
|
throw "The option `${showOption loc}' in `${opt._file}' is already declared in ${showFiles res.declarations}."
|
||||||
else
|
else
|
||||||
let
|
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;
|
getSubModules = opt.options.type.getSubModules or null;
|
||||||
submodules =
|
submodules =
|
||||||
if getSubModules != null then map (setDefaultModuleLocation opt._file) getSubModules ++ res.options
|
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;
|
else res.options;
|
||||||
in opt.options // res //
|
in opt.options // res //
|
||||||
{ declarations = res.declarations ++ [opt._file];
|
{ declarations = res.declarations ++ [opt._file];
|
||||||
|
@ -802,27 +794,13 @@ rec {
|
||||||
compare = a: b: (a.priority or 1000) < (b.priority or 1000);
|
compare = a: b: (a.priority or 1000) < (b.priority or 1000);
|
||||||
in sort compare defs';
|
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:
|
fixupOptionType = loc: opt:
|
||||||
let
|
if opt.type.getSubModules or null == null
|
||||||
options = opt.options or
|
then opt // { type = opt.type or types.unspecified; }
|
||||||
(throw "Option `${showOption loc}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");
|
else opt // { type = opt.type.substSubModules opt.options; options = []; };
|
||||||
|
|
||||||
# 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 = []; };
|
|
||||||
|
|
||||||
|
|
||||||
/* Properties. */
|
/* Properties. */
|
||||||
|
|
|
@ -79,8 +79,6 @@ rec {
|
||||||
visible ? null,
|
visible ? null,
|
||||||
# Whether the option can be set only once
|
# Whether the option can be set only once
|
||||||
readOnly ? null,
|
readOnly ? null,
|
||||||
# Deprecated, used by types.optionSet.
|
|
||||||
options ? null
|
|
||||||
} @ attrs:
|
} @ attrs:
|
||||||
attrs // { _type = "option"; };
|
attrs // { _type = "option"; };
|
||||||
|
|
||||||
|
|
|
@ -749,14 +749,6 @@ rec {
|
||||||
nestedTypes.finalType = finalType;
|
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.
|
# Augment the given type with an additional type check function.
|
||||||
addCheck = elemType: check: elemType // { check = x: elemType.check x && check x; };
|
addCheck = elemType: check: elemType // { check = x: elemType.check x && check x; };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue