From 3679813f37f442d290d64c7887f7443bf99f4531 Mon Sep 17 00:00:00 2001 From: Marc Weber Date: Fri, 6 Mar 2009 12:27:15 +0000 Subject: [PATCH] Convert "mingetty" svn path=/nixos/branches/fix-style/; revision=14395 --- system/options.nix | 39 +------------------- upstart-jobs/default.nix | 10 ----- upstart-jobs/mingetty.nix | 78 +++++++++++++++++++++++++++++++++++---- 3 files changed, 72 insertions(+), 55 deletions(-) diff --git a/system/options.nix b/system/options.nix index 6b9e58824a79..f08f31867e4d 100644 --- a/system/options.nix +++ b/system/options.nix @@ -441,44 +441,6 @@ in }; - mingetty = { - - ttys = mkOption { - default = [1 2 3 4 5 6]; - description = " - The list of tty (virtual console) devices on which to start a - login prompt. - "; - }; - - waitOnMounts = mkOption { - default = false; - description = " - Whether the login prompts on the virtual consoles will be - started before or after all file systems have been mounted. By - default we don't wait, but if for example your /home is on a - separate partition, you may want to turn this on. - "; - }; - - greetingLine = mkOption { - default = ''<<< Welcome to NixOS (\m) - Kernel \r (\l) >>>''; - description = " - Welcome line printed by mingetty. - "; - }; - - helpLine = mkOption { - default = ""; - description = " - Help line printed by mingetty below the welcome line. - Used by the installation CD to give some hints on - how to proceed. - "; - }; - - }; - }; nesting = { @@ -584,6 +546,7 @@ in (import ../upstart-jobs/postfix.nix) (import ../upstart-jobs/dovecot.nix) (import ../upstart-jobs/bind.nix) + (import ../upstart-jobs/mingetty.nix) # The terminals on ttyX. # nix (import ../upstart-jobs/nix.nix) # nix options and daemon diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index 3999f8c4e9dd..740b6785245e 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -140,16 +140,6 @@ let ["reboot" "halt" "system-halt" "power-off"] ) - # The terminals on ttyX. - ++ (map - (ttyNumber: makeJob (import ../upstart-jobs/mingetty.nix { - inherit (pkgs) mingetty; - inherit ttyNumber; - loginProgram = "${pkgs.pam_login}/bin/login"; - })) - (config.services.mingetty.ttys) - ) - # Transparent TTY backgrounds. ++ optional (config.services.ttyBackgrounds.enable && kernelPackages.splashutils != null) (import ../upstart-jobs/tty-backgrounds.nix { diff --git a/upstart-jobs/mingetty.nix b/upstart-jobs/mingetty.nix index 8f50ea5c9db2..c04d47061e9f 100644 --- a/upstart-jobs/mingetty.nix +++ b/upstart-jobs/mingetty.nix @@ -1,10 +1,74 @@ -{mingetty, ttyNumber, loginProgram}: +{pkgs, config, ...}: + +###### interface +let + inherit (pkgs.lib) mkOption mkIf; + + options = { + services = { + mingetty = { + + ttys = mkOption { + default = [1 2 3 4 5 6]; + description = " + The list of tty (virtual console) devices on which to start a + login prompt. + "; + }; + + waitOnMounts = mkOption { + default = false; + description = " + Whether the login prompts on the virtual consoles will be + started before or after all file systems have been mounted. By + default we don't wait, but if for example your /home is on a + separate partition, you may want to turn this on. + "; + }; + + greetingLine = mkOption { + default = ''<<< Welcome to NixOS (\m) - Kernel \r (\l) >>>''; + description = " + Welcome line printed by mingetty. + "; + }; + + helpLine = mkOption { + default = ""; + description = " + Help line printed by mingetty below the welcome line. + Used by the installation CD to give some hints on + how to proceed. + "; + }; + + }; + }; + }; +in + +###### implementation + +let + ttyNumbers = config.services.mingetty.ttys; + loginProgram = "${pkgs.pam_login}/bin/login"; + inherit (pkgs) mingetty; + +in { - name = "tty" + toString ttyNumber; - job = " - start on udev - stop on shutdown - respawn ${mingetty}/sbin/mingetty --loginprog=${loginProgram} --noclear tty${toString ttyNumber} - "; + require = [ + options + ]; + + services = { + extraJobs = map (ttyNumber : { + name = "tty" + toString ttyNumber; + job = " + start on udev + stop on shutdown + respawn ${mingetty}/sbin/mingetty --loginprog=${loginProgram} --noclear tty${toString ttyNumber} + "; + }) ttyNumbers; + }; }