diff options
Diffstat (limited to 'nixpkgs/lib/tests/modules/define-option-dependently-nested.nix')
-rw-r--r-- | nixpkgs/lib/tests/modules/define-option-dependently-nested.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/nixpkgs/lib/tests/modules/define-option-dependently-nested.nix b/nixpkgs/lib/tests/modules/define-option-dependently-nested.nix new file mode 100644 index 000000000000..69ee4255534a --- /dev/null +++ b/nixpkgs/lib/tests/modules/define-option-dependently-nested.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.set = { + value = if options ? set.enable then 360 else 7; + } + # Only define if possible. + // lib.optionalAttrs (options ? set.enable) { + enable = true; + }; + +} |