Merge pull request #38114 from oxij/nixos/doc-module

nixos: doc module

Changed files
+88 -71
nixos
-1
nixos/modules/config/system-path.nix
···
"/sbin"
"/share/applications"
"/share/desktop-directories"
-
"/share/doc"
"/share/emacs"
"/share/icons"
"/share/menus"
+77
nixos/modules/misc/documentation.nix
···
+
{ 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" ];
+
})
+
+
]);
+
+
}
+1 -2
nixos/modules/module-list.nix
···
./installer/tools/tools.nix
./misc/assertions.nix
./misc/crashdump.nix
+
./misc/documentation.nix
./misc/extra-arguments.nix
./misc/ids.nix
./misc/lib.nix
···
./programs/freetds.nix
./programs/gnupg.nix
./programs/gphoto2.nix
-
./programs/info.nix
./programs/java.nix
./programs/kbdlight.nix
./programs/less.nix
./programs/light.nix
-
./programs/man.nix
./programs/mosh.nix
./programs/mtr.nix
./programs/nano.nix
+2 -3
nixos/modules/profiles/minimal.nix
···
# This isn't perfect, but let's expect the user specifies an UTF-8 defaultLocale
i18n.supportedLocales = [ (config.i18n.defaultLocale + "/UTF-8") ];
+
+
documentation.enable = mkDefault false;
services.nixosManual.enable = mkDefault false;
-
-
programs.man.enable = mkDefault false;
-
programs.info.enable = mkDefault false;
sound.enable = mkDefault false;
}
-30
nixos/modules/programs/info.nix
···
-
{ config, lib, pkgs, ... }:
-
-
with lib;
-
-
{
-
-
options = {
-
-
programs.info.enable = mkOption {
-
type = types.bool;
-
default = true;
-
description = ''
-
Whether to enable info pages and the <command>info</command> command.
-
'';
-
};
-
-
};
-
-
-
config = mkIf config.programs.info.enable {
-
-
environment.systemPackages = [ pkgs.texinfoInteractive ];
-
-
environment.pathsToLink = [ "/info" "/share/info" ];
-
-
environment.extraOutputsToInstall = [ "info" ];
-
-
};
-
-
}
-31
nixos/modules/programs/man.nix
···
-
{ config, lib, pkgs, ... }:
-
-
with lib;
-
-
{
-
-
options = {
-
-
programs.man.enable = mkOption {
-
type = types.bool;
-
default = true;
-
description = ''
-
Whether to enable manual pages and the <command>man</command> command.
-
This also includes "man" outputs of all <literal>systemPackages</literal>.
-
'';
-
};
-
-
};
-
-
-
config = mkIf config.programs.man.enable {
-
-
environment.systemPackages = [ pkgs.man-db ];
-
-
environment.pathsToLink = [ "/share/man" ];
-
-
environment.extraOutputsToInstall = [ "man" ];
-
-
};
-
-
}
+4
nixos/modules/rename.nix
···
# Xen
(mkRenamedOptionModule [ "virtualisation" "xen" "qemu-package" ] [ "virtualisation" "xen" "package-qemu" ])
+
+
(mkRenamedOptionModule [ "programs" "info" "enable" ] [ "documentation" "info" "enable" ])
+
(mkRenamedOptionModule [ "programs" "man" "enable" ] [ "documentation" "man" "enable" ])
+
] ++ (flip map [ "blackboxExporter" "collectdExporter" "fritzboxExporter"
"jsonExporter" "minioExporter" "nginxExporter" "nodeExporter"
"snmpExporter" "unifiExporter" "varnishExporter" ]
+4 -4
nixos/modules/services/misc/nixos-manual.nix
···
system.build.manual = manual;
-
environment.systemPackages =
-
[ manual.manual helpScript ]
-
++ optionals config.services.xserver.enable [desktopItem pkgs.nixos-icons]
-
++ optional config.programs.man.enable manual.manpages;
+
environment.systemPackages = []
+
++ optionals config.services.xserver.enable [ desktopItem pkgs.nixos-icons ]
+
++ optional config.documentation.man.enable manual.manpages
+
++ optionals config.documentation.doc.enable [ manual.manual helpScript ];
boot.extraTTYs = mkIf cfg.showManual ["tty${toString cfg.ttyNumber}"];