aboutsummaryrefslogtreecommitdiff
path: root/tests/modules/define-option-dependently-nested.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-08-16 15:46:37 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-08-16 15:46:37 +0200
commit63e0b5d081fed582ac6a0a66f402dc525953524b (patch)
tree1bdcd7fc8a6a40b2e805bad759b36e64e911036b /tests/modules/define-option-dependently-nested.nix
GC root for fetched nixpkgs/lib content
Diffstat (limited to 'tests/modules/define-option-dependently-nested.nix')
-rw-r--r--tests/modules/define-option-dependently-nested.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/modules/define-option-dependently-nested.nix b/tests/modules/define-option-dependently-nested.nix
new file mode 100644
index 000000000..69ee42555
--- /dev/null
+++ b/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;
+ };
+
+}