at 18.09-beta 3.3 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let cfg = config.documentation; in 6 7{ 8 9 options = { 10 11 documentation = { 12 13 enable = mkOption { 14 type = types.bool; 15 default = true; 16 description = '' 17 Whether to install documentation of packages from 18 <option>environment.systemPackages</option> into the generated system path. 19 20 See "Multiple-output packages" chapter in the nixpkgs manual for more info. 21 ''; 22 # which is at ../../../doc/multiple-output.xml 23 }; 24 25 man.enable = mkOption { 26 type = types.bool; 27 default = true; 28 description = '' 29 Whether to install manual pages and the <command>man</command> command. 30 This also includes "man" outputs. 31 ''; 32 }; 33 34 info.enable = mkOption { 35 type = types.bool; 36 default = true; 37 description = '' 38 Whether to install info pages and the <command>info</command> command. 39 This also includes "info" outputs. 40 ''; 41 }; 42 43 doc.enable = mkOption { 44 type = types.bool; 45 default = true; 46 description = '' 47 Whether to install documentation distributed in packages' <literal>/share/doc</literal>. 48 Usually plain text and/or HTML. 49 This also includes "doc" outputs. 50 ''; 51 }; 52 53 dev.enable = mkOption { 54 type = types.bool; 55 default = false; 56 description = '' 57 Whether to install documentation targeted at developers. 58 <itemizedlist> 59 <listitem><para>This includes man pages targeted at developers if <option>man.enable</option> is 60 set (this also includes "devman" outputs).</para></listitem> 61 <listitem><para>This includes info pages targeted at developers if <option>info.enable</option> 62 is set (this also includes "devinfo" outputs).</para></listitem> 63 <listitem><para>This includes other pages targeted at developers if <option>doc.enable</option> 64 is set (this also includes "devdoc" outputs).</para></listitem> 65 </itemizedlist> 66 ''; 67 }; 68 69 }; 70 71 }; 72 73 config = mkIf cfg.enable (mkMerge [ 74 75 (mkIf cfg.man.enable { 76 environment.systemPackages = [ pkgs.man-db ]; 77 environment.pathsToLink = [ "/share/man" ]; 78 environment.extraOutputsToInstall = [ "man" ] ++ optional cfg.dev.enable "devman"; 79 }) 80 81 (mkIf cfg.info.enable { 82 environment.systemPackages = [ pkgs.texinfoInteractive ]; 83 environment.pathsToLink = [ "/share/info" ]; 84 environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable "devinfo"; 85 environment.extraSetup = '' 86 if [ -w $out/share/info ]; then 87 shopt -s nullglob 88 for i in $out/share/info/*.info $out/share/info/*.info.gz; do 89 ${pkgs.texinfo}/bin/install-info $i $out/share/info/dir 90 done 91 fi 92 ''; 93 }) 94 95 (mkIf cfg.doc.enable { 96 # TODO(@oxij): put it here and remove from profiles? 97 # environment.systemPackages = [ pkgs.w3m ]; # w3m-nox? 98 environment.pathsToLink = [ "/share/doc" ]; 99 environment.extraOutputsToInstall = [ "doc" ] ++ optional cfg.dev.enable "devdoc"; 100 }) 101 102 ]); 103 104}