2009-07-14 16:27:46 +00:00
|
|
|
# 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.
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
{ config, pkgs, options, ... }:
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
with pkgs.lib;
|
2009-04-14 12:31:08 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
let
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-07-14 16:27:46 +00:00
|
|
|
cfg = config.services.nixosManual;
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-09-18 15:27:10 +00:00
|
|
|
manual = import ../../../doc/manual {
|
|
|
|
inherit (cfg) revision;
|
|
|
|
inherit pkgs options;
|
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-07-14 16:27:46 +00:00
|
|
|
in
|
2009-04-14 12:31:08 +00:00
|
|
|
|
2009-07-14 16:27:46 +00:00
|
|
|
{
|
2009-04-14 12:31:08 +00:00
|
|
|
|
2009-07-14 16:27:46 +00:00
|
|
|
options = {
|
2009-01-08 23:30:23 +00:00
|
|
|
|
2009-07-14 16:27:46 +00:00
|
|
|
services.nixosManual.enable = mkOption {
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Whether to build the NixOS manual pages.
|
|
|
|
'';
|
|
|
|
};
|
2009-04-14 12:31:08 +00:00
|
|
|
|
2009-07-14 16:27:46 +00:00
|
|
|
services.nixosManual.showManual = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to show the NixOS manual on one of the virtual
|
|
|
|
consoles.
|
2009-01-08 23:30:23 +00:00
|
|
|
'';
|
2009-07-14 16:27:46 +00:00
|
|
|
};
|
2009-04-14 12:31:08 +00:00
|
|
|
|
2009-07-14 16:27:46 +00:00
|
|
|
services.nixosManual.ttyNumber = mkOption {
|
|
|
|
default = "8";
|
|
|
|
description = ''
|
|
|
|
Virtual console on which to show the manual.
|
|
|
|
'';
|
2009-01-08 23:30:23 +00:00
|
|
|
};
|
2009-04-14 12:31:08 +00:00
|
|
|
|
2009-07-14 16:27:46 +00:00
|
|
|
services.nixosManual.browser = mkOption {
|
|
|
|
default = "${pkgs.w3m}/bin/w3m";
|
|
|
|
description = ''
|
|
|
|
Browser used to show the manual.
|
|
|
|
'';
|
2009-01-08 23:30:23 +00:00
|
|
|
};
|
2009-04-14 12:31:08 +00:00
|
|
|
|
2009-09-18 15:27:10 +00:00
|
|
|
services.nixosManual.revision = mkOption {
|
|
|
|
default = "local";
|
|
|
|
type = types.uniq types.string;
|
|
|
|
description = ''
|
|
|
|
Revision of the targeted source file. This value can either be
|
2009-09-18 15:47:02 +00:00
|
|
|
<literal>"local"</literal>, <literal>"HEAD"</literal> or any
|
2009-09-18 15:27:10 +00:00
|
|
|
revision number embedded in a string.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-01-08 23:30:23 +00:00
|
|
|
};
|
2009-07-14 16:27:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2009-10-05 13:55:33 +00:00
|
|
|
system.build.manual = manual;
|
|
|
|
|
2010-08-11 12:28:53 +00:00
|
|
|
environment.systemPackages = [ manual.manpages ];
|
2009-07-14 16:27:46 +00:00
|
|
|
|
2009-10-15 14:35:10 +00:00
|
|
|
boot.extraTTYs = mkIf cfg.showManual ["tty${cfg.ttyNumber}"];
|
2009-07-14 16:27:46 +00:00
|
|
|
|
2009-10-12 18:09:34 +00:00
|
|
|
jobs = mkIf cfg.showManual
|
2011-09-14 18:20:50 +00:00
|
|
|
{ nixosManual =
|
2009-10-12 16:36:19 +00:00
|
|
|
{ name = "nixos-manual";
|
|
|
|
|
|
|
|
description = "NixOS manual";
|
2009-07-14 16:27:46 +00:00
|
|
|
|
2009-11-06 22:19:17 +00:00
|
|
|
startOn = "started udev";
|
2009-07-14 16:27:46 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
exec =
|
|
|
|
''
|
2010-08-11 12:28:53 +00:00
|
|
|
${cfg.browser} ${manual.manual}/share/doc/nixos/manual.html \
|
2009-10-12 16:36:19 +00:00
|
|
|
< /dev/tty${toString cfg.ttyNumber} > /dev/tty${toString cfg.ttyNumber} 2>&1
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2009-07-14 16:27:46 +00:00
|
|
|
|
2011-09-14 18:20:50 +00:00
|
|
|
services.ttyBackgrounds.specificThemes = mkIf cfg.showManual
|
2009-10-15 14:35:10 +00:00
|
|
|
[ { tty = "tty${cfg.ttyNumber}";
|
2009-07-14 16:27:46 +00:00
|
|
|
theme = pkgs.themes "green";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
services.mingetty.helpLine = mkIf cfg.showManual
|
|
|
|
"\nPress <Alt-F${toString cfg.ttyNumber}> for the NixOS manual.";
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-07-14 16:27:46 +00:00
|
|
|
};
|
|
|
|
|
2009-01-08 23:30:23 +00:00
|
|
|
}
|