diff options
author | Jan Malakhovski <oxij@oxij.org> | 2018-03-26 18:22:04 +0000 |
---|---|---|
committer | Jan Malakhovski <oxij@oxij.org> | 2018-03-30 06:52:26 +0000 |
commit | 98fd9b7f86e9548931935c1bb0c8f7fe5e5eb680 (patch) | |
tree | 2bcef86801233623be1d35d7faa33fbf9738a04c /nixos/modules/misc/documentation.nix | |
parent | a7af5d4f88f9e30bc9b401a84b7cb3cf036fccbb (diff) | |
download | nixlib-98fd9b7f86e9548931935c1bb0c8f7fe5e5eb680.tar nixlib-98fd9b7f86e9548931935c1bb0c8f7fe5e5eb680.tar.gz nixlib-98fd9b7f86e9548931935c1bb0c8f7fe5e5eb680.tar.bz2 nixlib-98fd9b7f86e9548931935c1bb0c8f7fe5e5eb680.tar.lz nixlib-98fd9b7f86e9548931935c1bb0c8f7fe5e5eb680.tar.xz nixlib-98fd9b7f86e9548931935c1bb0c8f7fe5e5eb680.tar.zst nixlib-98fd9b7f86e9548931935c1bb0c8f7fe5e5eb680.zip |
nixos: doc: introduce `documentation` config subtree
Diffstat (limited to 'nixos/modules/misc/documentation.nix')
-rw-r--r-- | nixos/modules/misc/documentation.nix | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/nixos/modules/misc/documentation.nix b/nixos/modules/misc/documentation.nix new file mode 100644 index 000000000000..cea8981370bb --- /dev/null +++ b/nixos/modules/misc/documentation.nix @@ -0,0 +1,77 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.documentation; in + +{ + + options = { + + documentation = { + + enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install documentation of packages from + <option>environment.systemPackages</option> into the generated system path. + ''; + }; + + man.enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install manual pages and the <command>man</command> command. + This also includes "man" outputs. + ''; + }; + + doc.enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install documentation distributed in packages' <literal>/share/doc</literal>. + Usually plain text and/or HTML. + This also includes "doc" outputs. + ''; + }; + + info.enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether to install info pages and the <command>info</command> command. + This also includes "info" outputs. + ''; + }; + + }; + + }; + + config = mkIf cfg.enable (mkMerge [ + + (mkIf cfg.man.enable { + environment.systemPackages = [ pkgs.man-db ]; + environment.pathsToLink = [ "/share/man" ]; + environment.extraOutputsToInstall = [ "man" ]; + }) + + (mkIf cfg.doc.enable { + # TODO(@oxij): put it here and remove from profiles? + # environment.systemPackages = [ pkgs.w3m ]; # w3m-nox? + environment.pathsToLink = [ "/share/doc" ]; + environment.extraOutputsToInstall = [ "doc" ]; + }) + + (mkIf cfg.info.enable { + environment.systemPackages = [ pkgs.texinfoInteractive ]; + environment.pathsToLink = [ "/share/info" ]; + environment.extraOutputsToInstall = [ "info" ]; + }) + + ]); + +} |