From 56e82309398f3d09eba7d6bc5bf04691c4483556 Mon Sep 17 00:00:00 2001 From: Firelight Flagboy Date: Wed, 5 Feb 2025 18:30:38 +0100 Subject: [PATCH] lib/options: Add `mkEnabledOption` Like `lib.options.mkEnableOption` but it's enabled by default --- lib/options.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/options.nix b/lib/options.nix index 668a6c42..233c47a6 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -64,6 +64,16 @@ in rec { inherit pluginDefaultText; + # Create an option declaration with a default value of `true`, and can be defined to `false`. + mkEnabledOption = + name: + lib.mkOption { + default = true; + example = false; + description = "Whether to enable ${name}."; + type = types.bool; + }; + # Creates an option with a nullable type that defaults to null. mkNullOrOption' = {