modules: documentation: use 'mkDisableOption'

The documentation module already gates behind 'documentation.enable' for
the other options.
This commit is contained in:
Bruno BELANYI 2021-05-07 17:04:18 +02:00
parent 7e1ca1f3d5
commit 2b6399606a

View file

@ -1,23 +1,18 @@
{ config, lib, ... }: { config, lib, ... }:
let let
cfg = config.my.module.documentation; cfg = config.my.module.documentation;
# I usually want everything enabled at once, but keep it customizable
defaultToGlobal = description: lib.mkEnableOption description // {
default = cfg.enable;
};
in in
{ {
options.my.module.documentation = with lib.my; { options.my.module.documentation = with lib.my; {
enable = mkDisableOption "Documentation integration"; enable = mkDisableOption "Documentation integration";
dev.enable = defaultToGlobal "Documentation aimed at developers"; dev.enable = mkDisableOption "Documentation aimed at developers";
info.enable = defaultToGlobal "Documentation aimed at developers"; info.enable = mkDisableOption "Documentation aimed at developers";
man.enable = defaultToGlobal "Documentation aimed at developers"; man.enable = mkDisableOption "Documentation aimed at developers";
nixos.enable = defaultToGlobal "NixOS documentation"; nixos.enable = mkDisableOption "NixOS documentation";
}; };
config.documentation = { config.documentation = {