summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorNicolas Pierron <nicolas.b.pierron@gmail.com>2014-08-29 18:52:31 +0200
committerNicolas Pierron <nicolas.b.pierron@gmail.com>2014-08-29 18:54:15 +0200
commiteb7a17a1cfc158b87e6d349f1fcc550761d122b9 (patch)
tree0c1dc1b6316acbcfbb257a824c3f435f612104c3 /lib
parent8c19690d99af8e25a58ce1a96ffda74340b88700 (diff)
downloadnixpkgs-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar
nixpkgs-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.gz
nixpkgs-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.bz2
nixpkgs-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.lz
nixpkgs-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.xz
nixpkgs-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.tar.zst
nixpkgs-eb7a17a1cfc158b87e6d349f1fcc550761d122b9.zip
Add error an message to prevent use of useless submodules.
Diffstat (limited to 'lib')
-rw-r--r--lib/modules.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index bcaadc7fd97..9fe26083cfd 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)