mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
lib/modules.nix: Add file context to unmerged values in mergeDefinitions
This helps with troubleshooting exceptions in config values, which were hard to track down for options with many definitions. The trace will look like: error: while evaluating the attribute 'config.foo' at undefined position: [...] while evaluating the option `foo': [...] while evaluating definitions from `/home/user/mymod.nix': while evaluating 'dischargeProperties' at /home/user/nixpkgs/lib/modules.nix:464:25, called from /home/user/nixpkgs/lib/modules.nix:392:137: while evaluating the attribute 'value' at /home/user/nixpkgs/lib/modules.nix:277:44: Value error! where the `/home/user/mymod.nix` module is { lib, ... }: { options.foo = lib.mkOption { type = lib.types.lines; }; config.foo = builtins.throw "Value error!"; }
This commit is contained in:
parent
a9b0ccd68e
commit
9c0ab2f26d
@ -389,7 +389,7 @@ rec {
|
||||
let
|
||||
# Process mkMerge and mkIf properties.
|
||||
defs' = concatMap (m:
|
||||
map (value: { inherit (m) file; inherit value; }) (dischargeProperties m.value)
|
||||
map (value: { inherit (m) file; inherit value; }) (builtins.addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
|
||||
) defs;
|
||||
|
||||
# Process mkOverride properties.
|
||||
|
Loading…
Reference in New Issue
Block a user