Skip to content

Commit 56e8230

Browse files
FirelightFlagboyMattSturgeon
authored andcommitted
lib/options: Add mkEnabledOption
Like `lib.options.mkEnableOption` but it's enabled by default
1 parent 7f2601a commit 56e8230

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/options.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ in
6464
rec {
6565
inherit pluginDefaultText;
6666

67+
# Create an option declaration with a default value of `true`, and can be defined to `false`.
68+
mkEnabledOption =
69+
name:
70+
lib.mkOption {
71+
default = true;
72+
example = false;
73+
description = "Whether to enable ${name}.";
74+
type = types.bool;
75+
};
76+
6777
# Creates an option with a nullable type that defaults to null.
6878
mkNullOrOption' =
6979
{

0 commit comments

Comments
 (0)