# Lib.options: add \`mkDisableOption\`

**URL:** https://discourse.nixos.org/t/lib-options-add-mkdisableoption/79646
**Category:** Development
**Created:** [August 17, 2026, 10:27pm UTC](https://discourse.nixos.org/t/lib-options-add-mkdisableoption/79646 "2026-08-17T22:27:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Malix](https://discourse.nixos.org/user_avatar/discourse.nixos.org/malix/32/17611_2.png) [@Malix](https://discourse.nixos.org/u/Malix)
#### Post date: [August 17, 2026, 10:27pm UTC](https://discourse.nixos.org/t/lib-options-add-mkdisableoption/79646/1 "2026-08-17T22:27:31Z")

</div>

> <https://github.com/NixOS/nixpkgs/pull/553735>
>
> lib.options: add \`mkDisableOption\`
> 
> Allow the creation of boolean option enabl…ed by default, which I would say is the third most common kind of options I have seen in NixOS and Home Manager after \`mkEnableOption\` and \`mkPackageOption\`
> 
> I also created a common helper:
> \`\`\`nix
> mkToggleOption =
> {
> default ? false,
> name,
> }:
> lib.mkOption {
> inherit default;
> example = !default;
> description = "Whether to ${if default then "disable" else "enable"} ${name}.";
> type = lib.types.bool;
> };
> \`\`\`
> 
> Which might be slightly overkill, but I'm a maniac.
> 
> \## Things done
> 
> 
> 
> \- Built on platform:
> - \[\] x86\_64-linux
> - \[\] aarch64-linux
> - \[\] aarch64-darwin
> \- Tested, as applicable:
> - \[\] \[NixOS tests\] in \[nixos/tests\].
> - \[\] \[Package tests\] at \`passthru.tests\`.
> - \[x\] Tests in \[lib/tests\] or \[pkgs/test\] for functions and "core" functionality.
> \- \[\] Ran \`nixpkgs-review\` on this PR. See \[nixpkgs-review usage\].
> \- \[\] Tested basic functionality of all binary files, usually in \`./result/bin/\`.
> \- Nixpkgs Release Notes
> - \[\] Package update: when the change is major or breaking.
> \- NixOS Release Notes
> - \[\] Module addition: when adding a new NixOS module.
> - \[\] Module update: when the change is significant.
> \- \[x\] Fits \[CONTRIBUTING.md\], \[pkgs/README.md\], \[maintainers/README.md\] and other READMEs.
> \- \[x\] Follows the \[automation/AI policy\]. None used
> 
> \[NixOS tests\]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
> \[Package tests\]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests
> \[nixpkgs-review usage\]: https://github.com/Mic92/nixpkgs-review#usage
> 
> \[CONTRIBUTING.md\]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
> \[automation/AI policy\]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md#automationai-policy
> \[lib/tests\]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
> \[maintainers/README.md\]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
> \[nixos/tests\]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
> \[pkgs/README.md\]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
> \[pkgs/test\]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test
