* Include the NixOS manpages in the system environment. Actually
there is only one currently: configuration.nix(5), which contains a list of all the options. svn path=/nixos/branches/modular-nixos/; revision=16360
This commit is contained in:
parent
896a9f0508
commit
da996583ee
@ -4,6 +4,7 @@ let
|
|||||||
|
|
||||||
manualConfig =
|
manualConfig =
|
||||||
{ environment.checkConfigurationOptions = false;
|
{ environment.checkConfigurationOptions = false;
|
||||||
|
services.nixosManual.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
options = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext
|
options = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext
|
||||||
|
@ -83,7 +83,7 @@ in
|
|||||||
boot.kernelPackages = pkgs.kernelPackages_2_6_29;
|
boot.kernelPackages = pkgs.kernelPackages_2_6_29;
|
||||||
|
|
||||||
# Show the manual.
|
# Show the manual.
|
||||||
services.showManual.enable = true;
|
services.nixosManual.showManual = true;
|
||||||
|
|
||||||
# Let the user play Rogue on TTY 8 during the installation.
|
# Let the user play Rogue on TTY 8 during the installation.
|
||||||
services.rogue.enable = true;
|
services.rogue.enable = true;
|
||||||
|
@ -1,104 +1,88 @@
|
|||||||
|
# This module includes the NixOS man-pages in the system environment,
|
||||||
|
# and optionally starts a browser that shows the NixOS manual on one
|
||||||
|
# of the virtual consoles. The latter is useful for the installation
|
||||||
|
# CD.
|
||||||
|
|
||||||
{pkgs, config, ...}:
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
# Show the NixOS manual on tty8
|
|
||||||
# Originally used only by installation CD
|
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (pkgs.lib) mkOption;
|
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
|
||||||
|
cfg = config.services.nixosManual;
|
||||||
|
|
||||||
|
manual =
|
||||||
|
# We could speed up the evaluation of the manual expression by
|
||||||
|
# providing it the optionDeclarations of the current
|
||||||
|
# configuration.
|
||||||
|
import ../../../doc/manual {inherit pkgs;};
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
services = {
|
|
||||||
|
|
||||||
showManual = {
|
services.nixosManual.enable = mkOption {
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to build the NixOS manual pages.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
enable = mkOption {
|
services.nixosManual.showManual = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
description = "
|
description = ''
|
||||||
Whether to show the NixOS manual on one of the virtual
|
Whether to show the NixOS manual on one of the virtual
|
||||||
consoles.
|
consoles.
|
||||||
";
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
ttyNumber = mkOption {
|
services.nixosManual.ttyNumber = mkOption {
|
||||||
default = "8";
|
default = "8";
|
||||||
description = "
|
description = ''
|
||||||
Virtual console on which to show the manual.
|
Virtual console on which to show the manual.
|
||||||
";
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
browser = mkOption {
|
services.nixosManual.browser = mkOption {
|
||||||
default = "${pkgs.w3m}/bin/w3m";
|
default = "${pkgs.w3m}/bin/w3m";
|
||||||
description = ''
|
description = ''
|
||||||
Browser used to show the manual.
|
Browser used to show the manual.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
manualFile = mkOption {
|
|
||||||
# Note: we can't use a default here (see below), since it
|
|
||||||
# causes an infinite recursion building the manual.
|
|
||||||
default = null;
|
|
||||||
description = "
|
|
||||||
NixOS manual HTML file
|
|
||||||
";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}; # showManual
|
|
||||||
|
|
||||||
}; # services
|
config = mkIf cfg.enable {
|
||||||
};
|
|
||||||
in
|
|
||||||
|
|
||||||
let
|
environment.systemPackages = [manual];
|
||||||
inherit (config.services.showManual) enable ttyNumber browser manualFile;
|
|
||||||
|
|
||||||
realManualFile =
|
boot.extraTTYs = mkIf cfg.showManual [cfg.ttyNumber];
|
||||||
if manualFile == null then
|
|
||||||
# We could speed up the evaluation of the manual expression by
|
|
||||||
# providing it the optionDeclarations of the current
|
|
||||||
# configuration.
|
|
||||||
"${import ../../../doc/manual {inherit pkgs;}}/manual.html"
|
|
||||||
else
|
|
||||||
manualFile;
|
|
||||||
|
|
||||||
inherit (pkgs.lib) mkIf mkThenElse;
|
services.extraJobs = mkIf cfg.showManual (pkgs.lib.singleton
|
||||||
in
|
{ name = "nixos-manual";
|
||||||
|
|
||||||
mkIf enable {
|
|
||||||
require = [
|
|
||||||
options
|
|
||||||
];
|
|
||||||
|
|
||||||
boot = {
|
|
||||||
extraTTYs = [ ttyNumber ];
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
|
||||||
|
|
||||||
extraJobs = [{
|
|
||||||
name = "nixos-manual";
|
|
||||||
|
|
||||||
job = ''
|
job = ''
|
||||||
description "NixOS manual"
|
description "NixOS manual"
|
||||||
|
|
||||||
start on udev
|
start on udev
|
||||||
stop on shutdown
|
stop on shutdown
|
||||||
respawn ${browser} ${realManualFile} < /dev/tty${toString ttyNumber} > /dev/tty${toString ttyNumber} 2>&1
|
respawn ${cfg.browser} ${manual}/share/doc/nixos/manual.html \
|
||||||
|
< /dev/tty${toString cfg.ttyNumber} > /dev/tty${toString cfg.ttyNumber} 2>&1
|
||||||
'';
|
'';
|
||||||
}];
|
});
|
||||||
|
|
||||||
ttyBackgrounds = {
|
services.ttyBackgrounds.specificThemes = mkIf cfg.showManual
|
||||||
specificThemes = [{
|
[ { tty = cfg.ttyNumber;
|
||||||
tty = ttyNumber;
|
|
||||||
theme = pkgs.themes "green";
|
theme = pkgs.themes "green";
|
||||||
}];
|
}
|
||||||
};
|
];
|
||||||
|
|
||||||
mingetty = {
|
services.mingetty.helpLine = mkIf cfg.showManual
|
||||||
helpLine = mkThenElse {
|
"\nPress <Alt-F${toString cfg.ttyNumber}> for the NixOS manual.";
|
||||||
thenPart = "\nPress <Alt-F${toString ttyNumber}> for the NixOS manual.";
|
|
||||||
elsePart = "";
|
};
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user