Skip to content

Commit

Permalink
lib/default.nix: improve error reporting in imported modules
Browse files Browse the repository at this point in the history
The hidden `_file` attribute allows more informative error reporting when evaluation fails in the module system. This should no longer blame the `lib.mkModules` function when an error happens in my modules.
  • Loading branch information
Frontear committed Dec 7, 2024
1 parent 1e59e05 commit 8dac4f4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
imported = import mod;
in {
# args = { config, lib, modulesPath, options, pkgs, ... }
__functor = _: args: imported (args // extraArgs);
__functor = _: args: (imported (args // extraArgs)) // {
_file = mod; # better error reporting in the module system
};
__functionArgs = final.functionArgs imported;
}))
];
Expand Down

0 comments on commit 8dac4f4

Please sign in to comment.