summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-01-08 17:36:43 +0100
committerGitHub <noreply@github.com>2020-01-08 17:36:43 +0100
commitb46776d14eb9388983296f1c73c4bd04430791bc (patch)
treea9b5ad3acab38d1ae87c01c0a822803f5723088e /lib/modules.nix
parentf4654713a3ca1820f0ff674ccf091d0cd0fcc8ff (diff)
parent43ef3a8d003fd64477b2eabb41e617e23e10a05f (diff)
downloadnixpkgs-b46776d14eb9388983296f1c73c4bd04430791bc.tar
nixpkgs-b46776d14eb9388983296f1c73c4bd04430791bc.tar.gz
nixpkgs-b46776d14eb9388983296f1c73c4bd04430791bc.tar.bz2
nixpkgs-b46776d14eb9388983296f1c73c4bd04430791bc.tar.lz
nixpkgs-b46776d14eb9388983296f1c73c4bd04430791bc.tar.xz
nixpkgs-b46776d14eb9388983296f1c73c4bd04430791bc.tar.zst
nixpkgs-b46776d14eb9388983296f1c73c4bd04430791bc.zip
Clarify error message of 'assigning to top-level attribute' (#76702)
Clarify error message of 'assigning to top-level attribute'
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index 48788ae933d..aebc9874aa4 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -123,7 +123,7 @@ rec {
     if m ? config || m ? options then
       let badAttrs = removeAttrs m ["_file" "key" "disabledModules" "imports" "options" "config" "meta"]; in
       if badAttrs != {} then
-        throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. This is caused by assignments to the top-level attributes `config' or `options'."
+        throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. This is caused by introducing a top-level `config' or `options' attribute. Add configuration attributes immediately on the top level instead, or move all of them (namely: ${toString (attrNames badAttrs)}) into the explicit `config' attribute."
       else
         { _file = m._file or file;
           key = toString m.key or key;