diff options
Diffstat (limited to 'lib/tests/modules')
-rw-r--r-- | lib/tests/modules/define-option-dependently.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/tests/modules/define-option-dependently.nix b/lib/tests/modules/define-option-dependently.nix new file mode 100644 index 0000000000000..6abce29366aef --- /dev/null +++ b/lib/tests/modules/define-option-dependently.nix @@ -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; + }; + +} |