2009-04-14 13:31:08 +01:00
|
|
|
{pkgs, config, ...}:
|
2009-01-08 23:30:23 +00:00
|
|
|
|
|
|
|
# Show the NixOS manual on tty7
|
|
|
|
# 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 = "
|
|
|
|
Whether to show the NixOS manual on the tty7
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
ttyNumber = mkOption {
|
|
|
|
default = "7";
|
|
|
|
description = "
|
|
|
|
TTY number name to show the manual on
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
browserPackage = mkOption {
|
|
|
|
default = pkgs.w3m;
|
|
|
|
description = "
|
|
|
|
Package containing the browser to be used
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
browserCommand = mkOption {
|
|
|
|
default = "bin/w3m";
|
|
|
|
description = "
|
|
|
|
Command (command path is relative to browserPackage) to run the browser
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
manualFile = mkOption {
|
|
|
|
default = null;
|
|
|
|
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
|
|
|
|
cfg = config.services.showManual;
|
2009-04-18 18:16:46 +01:00
|
|
|
in let # !!! Bug in Nix 0.13pre14722, otherwise the following line is not aware of cfg.
|
2009-04-14 13:31:08 +01:00
|
|
|
inherit (cfg) enable ttyNumber browserPackage browserCommand manualFile;
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-04-14 13:31:08 +01:00
|
|
|
realManualFile =
|
|
|
|
if manualFile == null then
|
|
|
|
(import ../doc/manual {nixpkgs = pkgs;})+"/manual.html"
|
|
|
|
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-01-08 23:30:23 +00:00
|
|
|
name = "showManual";
|
|
|
|
|
|
|
|
job = ''
|
|
|
|
description "NixOS manual"
|
2009-04-14 13:31:08 +01:00
|
|
|
|
|
|
|
start on udev
|
|
|
|
stop on shutdown
|
|
|
|
respawn ${browserPackage}/${browserCommand} ${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 {
|
|
|
|
thenPart = "\nPress <Alt-F${toString ttyNumber}> for NixOS manual.";
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|