lib/modules: Test the ability for config to depend on options for compatibility

This commit is contained in:
Robert Hensing
2020-03-17 20:21:10 +01:00
parent b6a5079800
commit 31206e44e1
2 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
{ lib, options, ... }:
# Some modules may be distributed separately and need to adapt to other modules
# that are distributed and versioned separately.
{
# Always defined, but the value depends on the presence of an option.
config = {
value = if options ? enable then 360 else 7;
}
# Only define if possible.
// lib.optionalAttrs (options ? enable) {
enable = true;
};
}