diff options
author | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2009-04-14 12:31:08 +0000 |
---|---|---|
committer | Nicolas Pierron <nicolas.b.pierron@gmail.com> | 2009-04-14 12:31:08 +0000 |
commit | 47b61bdd4aa7dcb98f3b069969d8f9882e18ea05 (patch) | |
tree | cd155a9a14f626c829693f71056358e5c5b126b1 /upstart-jobs/manual.nix | |
parent | 9741be988c37a9373357d62247bacb9f29444e83 (diff) | |
download | nixpkgs-47b61bdd4aa7dcb98f3b069969d8f9882e18ea05.tar nixpkgs-47b61bdd4aa7dcb98f3b069969d8f9882e18ea05.tar.gz nixpkgs-47b61bdd4aa7dcb98f3b069969d8f9882e18ea05.tar.bz2 nixpkgs-47b61bdd4aa7dcb98f3b069969d8f9882e18ea05.tar.lz nixpkgs-47b61bdd4aa7dcb98f3b069969d8f9882e18ea05.tar.xz nixpkgs-47b61bdd4aa7dcb98f3b069969d8f9882e18ea05.tar.zst nixpkgs-47b61bdd4aa7dcb98f3b069969d8f9882e18ea05.zip |
* upstart-jobs/manual.nix:
- Replace "optional" function by one "mkIf". - Pretty-print (indentation, extra lines, no trailing-whitespaces). svn path=/nixos/branches/modular-nixos/; revision=15025
Diffstat (limited to 'upstart-jobs/manual.nix')
-rw-r--r-- | upstart-jobs/manual.nix | 123 |
1 files changed, 71 insertions, 52 deletions
diff --git a/upstart-jobs/manual.nix b/upstart-jobs/manual.nix index c515e95d3dd..882cf8f8251 100644 --- a/upstart-jobs/manual.nix +++ b/upstart-jobs/manual.nix @@ -1,87 +1,106 @@ -{pkgs, config, ...}: +{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 - "; - }; - }; - }; + 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 }; +in -inherit(pkgs.lib) optional; +let + cfg = config.services.showManual; + inherit (cfg) enable ttyNumber browserPackage browserCommand manualFile; -inherit (config.services.showManual) enable ttyNumber browserPackage browserCommand - manualFile; - -realManualFile = if manualFile == null then - (import ../doc/manual {nixpkgs = pkgs;})+"/manual.html" -else manualFile; + realManualFile = + if manualFile == null then + (import ../doc/manual {nixpkgs = pkgs;})+"/manual.html" + else + manualFile; + inherit (pkgs.lib) mkIf mkThenElse; in -{ +mkIf enable { require = [ options ]; boot = { - extraTTYs = optional enable ttyNumber; + extraTTYs = [ ttyNumber ]; }; - + services = { - extraJobs = optional enable { + + extraJobs = [{ 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 + + start on udev + stop on shutdown + respawn ${browserPackage}/${browserCommand} ${realManualFile} < /dev/tty${toString ttyNumber} > /dev/tty${toString ttyNumber} 2>&1 ''; - }; + }]; + ttyBackgrounds = { - specificThemes = optional enable { + specificThemes = [{ tty = ttyNumber; - theme = pkgs.themes "green"; - }; + theme = pkgs.themes "green"; + }]; }; + mingetty = { - helpLine = if enable then "\nPress <Alt-F${toString ttyNumber}> for NixOS manual." else ""; + helpLine = mkThenElse { + thenPart = "\nPress <Alt-F${toString ttyNumber}> for NixOS manual."; + elsePart = ""; + }; }; + }; } |