summary refs log tree commit diff
path: root/lib/tests/modules/define-option-dependently-nested.nix
blob: 69ee4255534a3e96f3d0fac61b5b582242b86c78 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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.set = {
    value = if options ? set.enable then 360 else 7;
  }
  # Only define if possible.
  // lib.optionalAttrs (options ? set.enable) {
    enable = true;
  };

}