mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 21:33:03 +03:00
Add error an message to prevent use of useless submodules.
This commit is contained in:
parent
8c19690d99
commit
eb7a17a1cf
@ -277,13 +277,14 @@ rec {
|
|||||||
fixupOptionType = loc: opt:
|
fixupOptionType = loc: opt:
|
||||||
let
|
let
|
||||||
options' = opt.options or
|
options' = opt.options or
|
||||||
(throw "Option `${showOption loc'}' has type optionSet but has no option attribute.");
|
(throw "Option `${showOption loc'}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}.");
|
||||||
coerce = x:
|
coerce = x:
|
||||||
if isFunction x then x
|
if isFunction x then x
|
||||||
else { config, ... }: { options = x; };
|
else { config, ... }: { options = x; };
|
||||||
options = map coerce (flatten options');
|
options = map coerce (flatten options');
|
||||||
f = tp:
|
f = tp:
|
||||||
if tp.name == "option set" then types.submodule options
|
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.name == "attribute set of option sets" then types.attrsOf (types.submodule options)
|
else if tp.name == "attribute set of option sets" then types.attrsOf (types.submodule options)
|
||||||
else if tp.name == "list or attribute set of option sets" then types.loaOf (types.submodule options)
|
else if tp.name == "list or attribute set of option sets" then types.loaOf (types.submodule options)
|
||||||
else if tp.name == "list of option sets" then types.listOf (types.submodule options)
|
else if tp.name == "list of option sets" then types.listOf (types.submodule options)
|
||||||
|
Loading…
Reference in New Issue
Block a user