An upstart job to display manual
svn path=/nixos/trunk/; revision=13728
This commit is contained in:
parent
aa393f816c
commit
0a1f41c742
@ -1,10 +1,10 @@
|
|||||||
{nixpkgsPath ? ../../../nixpkgs, pkgs ? null}:
|
{nixpkgsPath ? ../../../nixpkgs, nixpkgs ? null}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
pkgs = if pkgs == null then
|
pkgs = if nixpkgs == null then
|
||||||
import "${nixpkgsPath}/pkgs/top-level/all-packages.nix" {}
|
import "${nixpkgsPath}/pkgs/top-level/all-packages.nix" {}
|
||||||
else pkgs;
|
else nixpkgs;
|
||||||
|
|
||||||
options = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext
|
options = builtins.toFile "options.xml" (builtins.unsafeDiscardStringContext
|
||||||
(builtins.toXML (pkgs.lib.optionAttrSetToDocList ""
|
(builtins.toXML (pkgs.lib.optionAttrSetToDocList ""
|
||||||
|
@ -3063,5 +3063,6 @@ root ALL=(ALL) SETENV: ALL
|
|||||||
(import ../upstart-jobs/cron.nix)
|
(import ../upstart-jobs/cron.nix)
|
||||||
(import ../upstart-jobs/fcron.nix)
|
(import ../upstart-jobs/fcron.nix)
|
||||||
(import ../upstart-jobs/cron/locate.nix)
|
(import ../upstart-jobs/cron/locate.nix)
|
||||||
|
(import ../upstart-jobs/manual.nix)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{ platform ? __currentSystem
|
{ platform ? __currentSystem
|
||||||
, configuration
|
, configuration
|
||||||
, nixpkgsPath ? ../../nixpkgs
|
, nixpkgsPath ? ../../nixpkgs
|
||||||
|
, nixpkgs ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
@ -26,7 +27,9 @@ rec {
|
|||||||
pkgs configComponents
|
pkgs configComponents
|
||||||
config;
|
config;
|
||||||
|
|
||||||
pkgs = import "${nixpkgsPath}/pkgs/top-level/all-packages.nix" {system = platform;};
|
pkgs = if nixpkgs == null then
|
||||||
|
import "${nixpkgsPath}/pkgs/top-level/all-packages.nix" {system = platform;}
|
||||||
|
else nixpkgs;
|
||||||
|
|
||||||
manifests = config.installer.manifests; # exported here because nixos-rebuild uses it
|
manifests = config.installer.manifests; # exported here because nixos-rebuild uses it
|
||||||
|
|
||||||
|
87
upstart-jobs/manual.nix
Normal file
87
upstart-jobs/manual.nix
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
{pkgs, config}:
|
||||||
|
|
||||||
|
# Show the NixOS manual on tty7
|
||||||
|
# Originally used only by installation CD
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption;
|
||||||
|
options = {
|
||||||
|
services = {
|
||||||
|
showManual = {
|
||||||
|
enable = mkOption {
|
||||||
|
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
|
||||||
|
";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit(pkgs.lib) optional;
|
||||||
|
|
||||||
|
inherit (config.services.showManual) enable ttyNumber browserPackage browserCommand
|
||||||
|
manualFile;
|
||||||
|
|
||||||
|
realManualFile = if manualFile == null then
|
||||||
|
(import ../doc/manual {nixpkgs = pkgs;})+"/manual.html"
|
||||||
|
else manualFile;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
require = [
|
||||||
|
options
|
||||||
|
];
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
extraTTYs = optional enable ttyNumber;
|
||||||
|
};
|
||||||
|
|
||||||
|
services = {
|
||||||
|
extraJobs = optional enable {
|
||||||
|
name = "showManual";
|
||||||
|
|
||||||
|
job = ''
|
||||||
|
description "NixOS manual"
|
||||||
|
|
||||||
|
start on udev
|
||||||
|
stop on shutdown
|
||||||
|
respawn ${browserPackage}/${browserCommand} ${realManualFile} < /dev/tty${toString ttyNumber} > /dev/tty${toString ttyNumber} 2>&1
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
ttyBackgrounds = {
|
||||||
|
specificThemes = optional enable {
|
||||||
|
tty = ttyNumber;
|
||||||
|
theme = pkgs.themes "green";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
mingetty = {
|
||||||
|
helpLine = if enable then "\nPress <Alt-F${toString ttyNumber}> for NixOS manual." else "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user