aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/lib/tests/modules/define-option-dependently.nix
blob: 6abce29366aefd4835c09811ac333b0c57f7dc7d (plain)
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 = {
    value = if options ? enable then 360 else 7;
  } 
  # Only define if possible.
  // lib.optionalAttrs (options ? enable) {
    enable = true;
  };

}