summary refs log tree commit diff
path: root/upstart-jobs/manual.nix
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2009-01-08 23:30:23 +0000
committerMichael Raskin <7c6f434c@mail.ru>2009-01-08 23:30:23 +0000
commit0a1f41c7427a5e376cf02c27b6c16f61c416a303 (patch)
treec1a0a8d5094d4267cf5a0e8aac2efda643a005e0 /upstart-jobs/manual.nix
parentaa393f816c0647d889818879792b7b298b4a109b (diff)
downloadnixpkgs-0a1f41c7427a5e376cf02c27b6c16f61c416a303.tar
nixpkgs-0a1f41c7427a5e376cf02c27b6c16f61c416a303.tar.gz
nixpkgs-0a1f41c7427a5e376cf02c27b6c16f61c416a303.tar.bz2
nixpkgs-0a1f41c7427a5e376cf02c27b6c16f61c416a303.tar.lz
nixpkgs-0a1f41c7427a5e376cf02c27b6c16f61c416a303.tar.xz
nixpkgs-0a1f41c7427a5e376cf02c27b6c16f61c416a303.tar.zst
nixpkgs-0a1f41c7427a5e376cf02c27b6c16f61c416a303.zip
An upstart job to display manual
svn path=/nixos/trunk/; revision=13728
Diffstat (limited to 'upstart-jobs/manual.nix')
-rw-r--r--upstart-jobs/manual.nix87
1 files changed, 87 insertions, 0 deletions
diff --git a/upstart-jobs/manual.nix b/upstart-jobs/manual.nix
new file mode 100644
index 00000000000..5d658ce7681
--- /dev/null
+++ b/upstart-jobs/manual.nix
@@ -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 "";
+    };
+  };
+}