aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/lib/tests/modules/define-option-dependently.nix
blob: ad85f99a919fc9e6090e33d8fb2892ac2cf9a554 (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;
  };

}