Show precise error messages in option merge failures

For instance, if time.timeZone is defined multiple times, you now get
the error message:

  error: user-thrown exception: The unique option `time.timeZone' is defined multiple times, in `/etc/nixos/configurations/misc/eelco/x11vnc.nix' and `/etc/nixos/configuration.nix'.

while previously you got:

  error: user-thrown exception: Multiple definitions of string. Only one is allowed for this option.

and only an inspection of the stack trace gave a clue as to what
option caused the problem.
This commit is contained in:
Eelco Dolstra
2013-10-28 22:45:57 +01:00
parent dbefab9cf4
commit 73f32d0375
6 changed files with 58 additions and 56 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ let
sysctlOption = mkOptionType {
name = "sysctl option value";
check = x: builtins.isBool x || builtins.isString x || builtins.isInt x;
merge = xs: last xs; # FIXME: hacky way to allow overriding in configuration.nix.
merge = args: xs: last xs; # FIXME: hacky way to allow overriding in configuration.nix.
};
in