From e51ab70d5b533e9afdd0aba49a0c1697b251d3ca Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 17 Apr 2021 11:40:28 +0000 Subject: [PATCH] modules: add documentation --- modules/default.nix | 1 + modules/documentation.nix | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 modules/documentation.nix diff --git a/modules/default.nix b/modules/default.nix index 15fac7d..082a8da 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -3,6 +3,7 @@ { imports = [ + ./documentation.nix ./ergodox.nix ./language.nix ./media.nix diff --git a/modules/documentation.nix b/modules/documentation.nix new file mode 100644 index 0000000..5f67197 --- /dev/null +++ b/modules/documentation.nix @@ -0,0 +1,37 @@ +{ config, lib, ... }: +let + 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 +{ + options.my.module.documentation = with lib.my; { + enable = mkDisableOption "Documentation integration"; + + dev.enable = defaultToGlobal "Documentation aimed at developers"; + + info.enable = defaultToGlobal "Documentation aimed at developers"; + + man.enable = defaultToGlobal "Documentation aimed at developers"; + + nixos.enable = defaultToGlobal "NixOS documentation"; + }; + + config.documentation = { + enable = cfg.enable; + + dev.enable = cfg.dev.enable; + + info.enable = cfg.info.enable; + + man = { + enable = cfg.man.enable; + generateCaches = true; + }; + + nixos.enable = cfg.nixos.enable; + }; +}