-
-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/modules: Throw earlier when module function does not return attrs
`m` must always be an attrset at this point. It is basically always evaluated. This will make it throw when any of the attrs is accessed, rather than just `config`. We assume that this will improve the error message in more scenarios.
- Loading branch information
Showing
3 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ config, lib, ... }: | ||
let | ||
inherit (lib) types mkOption setDefaultModuleLocation evalModules; | ||
inherit (types) deferredModule lazyAttrsOf submodule str raw enum; | ||
in | ||
{ | ||
options = { | ||
deferred = mkOption { | ||
type = deferredModule; | ||
}; | ||
result = mkOption { | ||
default = (evalModules { modules = [ config.deferred ]; }).config.result; | ||
}; | ||
}; | ||
config = { | ||
deferred = { ... }: | ||
# this should be an attrset, so this fails | ||
true; | ||
}; | ||
} |