diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/modules.nix | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index de6fadbcb91c..02a669df6593 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -449,7 +449,13 @@ rec { # Handle properties, check types, and merge everything together. res = if opt.readOnly or false && length defs' > 1 then - throw "The option `${showOption loc}' is read-only, but it's set multiple times. Definition values:${showDefs defs'}" + let + # For a better error message, evaluate all readOnly definitions as + # if they were the only definition. + separateDefs = map (def: def // { + value = (mergeDefinitions loc opt.type [ def ]).mergedValue; + }) defs'; + in throw "The option `${showOption loc}' is read-only, but it's set multiple times. Definition values:${showDefs separateDefs}" else mergeDefinitions loc opt.type defs'; |