2009-04-14 13:31:08 +01:00
|
|
|
{pkgs, config, ...}:
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-06-10 13:53:45 +01:00
|
|
|
# Show the NixOS manual on tty8
|
2009-01-08 23:30:23 +00:00
|
|
|
# Originally used only by installation CD
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (pkgs.lib) mkOption;
|
2009-04-14 13:31:08 +01:00
|
|
|
|
2009-01-08 23:30:23 +00:00
|
|
|
options = {
|
|
|
|
services = {
|
2009-04-14 13:31:08 +01:00
|
|
|
|
2009-01-08 23:30:23 +00:00
|
|
|
showManual = {
|
2009-04-14 13:31:08 +01:00
|
|
|
|
2009-01-08 23:30:23 +00:00
|
|
|
enable = mkOption {
|
2009-04-14 13:31:08 +01:00
|
|
|
default = false;
|
|
|
|
description = "
|
2009-06-10 13:53:45 +01:00
|
|
|
Whether to show the NixOS manual on one of the virtual
|
|
|
|
consoles.
|
2009-04-14 13:31:08 +01:00
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
ttyNumber = mkOption {
|
2009-06-10 13:53:45 +01:00
|
|
|
default = "8";
|
2009-04-14 13:31:08 +01:00
|
|
|
description = "
|
2009-06-10 13:53:45 +01:00
|
|
|
Virtual console on which to show the manual.
|
2009-04-14 13:31:08 +01:00
|
|
|
";
|
|
|
|
};
|
|
|
|
|
2009-06-10 13:53:45 +01:00
|
|
|
browser = mkOption {
|
|
|
|
default = "${pkgs.w3m}/bin/w3m";
|
|
|
|
description = ''
|
|
|
|
Browser used to show the manual.
|
|
|
|
'';
|
2009-04-14 13:31:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
manualFile = mkOption {
|
2009-06-05 16:04:58 +01:00
|
|
|
# Note: we can't use a default here (see below), since it
|
|
|
|
# causes an infinite recursion building the manual.
|
|
|
|
default = null;
|
2009-04-14 13:31:08 +01:00
|
|
|
description = "
|
|
|
|
NixOS manual HTML file
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
}; # showManual
|
|
|
|
|
|
|
|
}; # services
|
2009-01-08 23:30:23 +00:00
|
|
|
};
|
2009-04-14 13:31:08 +01:00
|
|
|
in
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-04-14 13:31:08 +01:00
|
|
|
let
|
2009-06-10 13:53:45 +01:00
|
|
|
inherit (config.services.showManual) enable ttyNumber browser manualFile;
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-04-14 13:31:08 +01:00
|
|
|
realManualFile =
|
|
|
|
if manualFile == null then
|
2009-06-05 16:04:58 +01:00
|
|
|
# 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"
|
2009-04-14 13:31:08 +01:00
|
|
|
else
|
|
|
|
manualFile;
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-04-14 13:31:08 +01:00
|
|
|
inherit (pkgs.lib) mkIf mkThenElse;
|
2009-01-08 23:30:23 +00:00
|
|
|
in
|
|
|
|
|
2009-04-14 13:31:08 +01:00
|
|
|
mkIf enable {
|
2009-01-08 23:30:23 +00:00
|
|
|
require = [
|
|
|
|
options
|
|
|
|
];
|
|
|
|
|
|
|
|
boot = {
|
2009-04-14 13:31:08 +01:00
|
|
|
extraTTYs = [ ttyNumber ];
|
2009-01-08 23:30:23 +00:00
|
|
|
};
|
2009-04-14 13:31:08 +01:00
|
|
|
|
2009-01-08 23:30:23 +00:00
|
|
|
services = {
|
2009-04-14 13:31:08 +01:00
|
|
|
|
|
|
|
extraJobs = [{
|
2009-05-25 00:13:23 +01:00
|
|
|
name = "nixos-manual";
|
2009-01-08 23:30:23 +00:00
|
|
|
|
|
|
|
job = ''
|
|
|
|
description "NixOS manual"
|
2009-04-14 13:31:08 +01:00
|
|
|
|
|
|
|
start on udev
|
|
|
|
stop on shutdown
|
2009-06-10 13:53:45 +01:00
|
|
|
respawn ${browser} ${realManualFile} < /dev/tty${toString ttyNumber} > /dev/tty${toString ttyNumber} 2>&1
|
2009-01-08 23:30:23 +00:00
|
|
|
'';
|
2009-04-14 13:31:08 +01:00
|
|
|
}];
|
|
|
|
|
2009-01-08 23:30:23 +00:00
|
|
|
ttyBackgrounds = {
|
2009-04-14 13:31:08 +01:00
|
|
|
specificThemes = [{
|
2009-01-08 23:30:23 +00:00
|
|
|
tty = ttyNumber;
|
2009-04-14 13:31:08 +01:00
|
|
|
theme = pkgs.themes "green";
|
|
|
|
}];
|
2009-01-08 23:30:23 +00:00
|
|
|
};
|
2009-04-14 13:31:08 +01:00
|
|
|
|
2009-01-08 23:30:23 +00:00
|
|
|
mingetty = {
|
2009-04-14 13:31:08 +01:00
|
|
|
helpLine = mkThenElse {
|
2009-06-08 23:44:05 +01:00
|
|
|
thenPart = "\nPress <Alt-F${toString ttyNumber}> for the NixOS manual.";
|
2009-04-14 13:31:08 +01:00
|
|
|
elsePart = "";
|
|
|
|
};
|
2009-01-08 23:30:23 +00:00
|
|
|
};
|
2009-04-14 13:31:08 +01:00
|
|
|
|
2009-01-08 23:30:23 +00:00
|
|
|
};
|
|
|
|
}
|