diff options
author | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2014-08-29 18:52:31 +0200 |
---|---|---|
committer | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2014-08-29 18:54:15 +0200 |
commit | eb7a17a1cfc158b87e6d349f1fcc550761d122b9 (patch) | |
tree | 0c1dc1b6316acbcfbb257a824c3f435f612104c3 | |
parent | 8c19690d99af8e25a58ce1a96ffda74340b88700 (diff) | |
download | nixlib-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar nixlib-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.gz nixlib-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.bz2 nixlib-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.lz nixlib-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.xz nixlib-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.zst nixlib-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.zip |
Add error an message to prevent use of useless submodules.
-rw-r--r-- | lib/modules.nix | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index bcaadc7fd977..9fe26083cfd4 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -277,13 +277,14 @@ rec { fixupOptionType = loc: opt: let 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: if isFunction x then x else { config, ... }: { options = x; }; options = map coerce (flatten options'); 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 == "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) |