* r17391 changed the mingetty ttys to device names instead of tty
numbers. This also requires kbd and tty-backgrounds to be updated (and by extension syslogd and rogue). Also updated the style of those modules. svn path=/nixos/trunk/; revision=17424
This commit is contained in:
parent
69998a8d61
commit
38898d5304
|
@ -1,33 +1,11 @@
|
|||
{pkgs, config, ...}:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
###### interface
|
||||
let
|
||||
inherit (pkgs.lib) mkOption mkIf;
|
||||
|
||||
options = {
|
||||
services = {
|
||||
|
||||
syslogd = {
|
||||
|
||||
tty = mkOption {
|
||||
default = 10;
|
||||
description = "
|
||||
The tty device on which syslogd will print important log
|
||||
messages.
|
||||
";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
||||
###### implementation
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
syslogConf = pkgs.writeText "syslog.conf" ''
|
||||
kern.warning;*.err;authpriv.none /dev/tty10
|
||||
kern.warning;*.err;authpriv.none /dev/${config.services.syslogd.tty}
|
||||
|
||||
# Send emergency messages to all users.
|
||||
*.emerg *
|
||||
|
@ -46,24 +24,42 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
require = [
|
||||
options
|
||||
];
|
||||
###### interface
|
||||
|
||||
services = {
|
||||
extraJobs = [{
|
||||
name = "syslogd";
|
||||
|
||||
job = ''
|
||||
description "Syslog daemon"
|
||||
|
||||
start on udev
|
||||
stop on shutdown
|
||||
options = {
|
||||
|
||||
services.syslogd = {
|
||||
|
||||
env TZ=${config.time.timeZone}
|
||||
|
||||
respawn ${pkgs.sysklogd}/sbin/syslogd -n -f ${syslogConf}
|
||||
tty = mkOption {
|
||||
default = "tty10";
|
||||
description = ''
|
||||
The tty device on which syslogd will print important log
|
||||
messages.
|
||||
'';
|
||||
}];
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
|
||||
config = {
|
||||
|
||||
jobs = singleton
|
||||
{ name = "syslogd";
|
||||
|
||||
description = "Syslog daemon";
|
||||
|
||||
startOn = "udev";
|
||||
stopOn = "shutdown";
|
||||
|
||||
environment = { TZ = config.time.timeZone; };
|
||||
|
||||
exec = "${pkgs.sysklogd}/sbin/syslogd -n -f ${syslogConf}";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
{pkgs, config, ...}:
|
||||
# Execute the game `rogue' on tty 9. Mostly used by the NixOS
|
||||
# installation CD.
|
||||
|
||||
# Show rogue game on tty9
|
||||
# Originally used only by installation CD
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
inherit (pkgs.lib) mkOption;
|
||||
cfg = config.services.rogue;
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
services.rogue.enable = mkOption {
|
||||
|
@ -17,43 +24,40 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
services.rogue.ttyNumber = mkOption {
|
||||
default = "9";
|
||||
services.rogue.tty = mkOption {
|
||||
default = "tty9";
|
||||
description = ''
|
||||
Virtual console on which to run Rogue.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
cfg = config.services.rogue;
|
||||
###### implementation
|
||||
|
||||
in
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
pkgs.lib.mkIf cfg.enable {
|
||||
require = [options];
|
||||
|
||||
boot.extraTTYs = [cfg.ttyNumber];
|
||||
boot.extraTTYs = [ cfg.tty ];
|
||||
|
||||
services.extraJobs = pkgs.lib.singleton
|
||||
{ name = "rogue";
|
||||
jobs = singleton
|
||||
{ name = "rogue";
|
||||
|
||||
job = ''
|
||||
description "Rogue dungeon crawling game"
|
||||
|
||||
start on udev
|
||||
stop on shutdown
|
||||
description = "Rogue dungeon crawling game";
|
||||
|
||||
chdir /root
|
||||
startOn = "udev";
|
||||
stopOn = "shutdown";
|
||||
|
||||
respawn ${pkgs.rogue}/bin/rogue < /dev/tty${toString cfg.ttyNumber} > /dev/tty${toString cfg.ttyNumber} 2>&1
|
||||
'';
|
||||
};
|
||||
extraConfig = "chdir /root";
|
||||
|
||||
services.ttyBackgrounds.specificThemes = pkgs.lib.singleton
|
||||
{ tty = cfg.ttyNumber;
|
||||
theme = pkgs.themes "theme-gnu";
|
||||
};
|
||||
exec = "${pkgs.rogue}/bin/rogue < /dev/{cfg.tty} > /dev/{cfg.tty} 2>&1";
|
||||
};
|
||||
|
||||
services.mingetty.helpLine = "\nPress <Alt-F${toString cfg.ttyNumber}> to play Rogue.";
|
||||
services.ttyBackgrounds.specificThemes = singleton
|
||||
{ tty = cfg.tty;
|
||||
theme = pkgs.themes "theme-gnu";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
{pkgs, config, ...}:
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
let
|
||||
|
||||
# think about where to put this chunk of code!
|
||||
# required by other pieces as well
|
||||
requiredTTYs = config.services.mingetty.ttys
|
||||
++ config.boot.extraTTYs
|
||||
++ [config.services.syslogd.tty];
|
||||
ttyNumbers = requiredTTYs;
|
||||
ttys = map (nr: "/dev/tty" + toString nr) ttyNumbers;
|
||||
++ [ config.services.syslogd.tty ];
|
||||
ttys = map (dev: "/dev/${dev}") requiredTTYs;
|
||||
defaultLocale = config.i18n.defaultLocale;
|
||||
consoleFont = config.i18n.consoleFont;
|
||||
consoleKeyMap = config.i18n.consoleKeyMap;
|
||||
|
@ -22,21 +23,21 @@ in
|
|||
|
||||
# most options are defined in i18n.nix
|
||||
|
||||
boot.extraTTYs = pkgs.lib.mkOption {
|
||||
boot.extraTTYs = mkOption {
|
||||
default = [];
|
||||
example = [8 9];
|
||||
description = "
|
||||
example = ["tty8" "tty9"];
|
||||
description = ''
|
||||
Tty (virtual console) devices, in addition to the consoles on
|
||||
which mingetty and syslogd run, that must be initialised.
|
||||
Only useful if you have some program that you want to run on
|
||||
some fixed console. For example, the NixOS installation CD
|
||||
opens the manual in a web browser on console 7, so it sets
|
||||
<option>boot.extraTTYs</option> to <literal>[7]</literal>.
|
||||
";
|
||||
<option>boot.extraTTYs</option> to <literal>["tty7"]</literal>.
|
||||
'';
|
||||
};
|
||||
|
||||
# dummy option so that requiredTTYs can be passed
|
||||
requiredTTYs = pkgs.lib.mkOption {
|
||||
requiredTTYs = mkOption {
|
||||
default = [];
|
||||
description = "
|
||||
FIXME: find another place for this option.
|
||||
|
@ -55,16 +56,14 @@ in
|
|||
|
||||
environment.systemPackages = [pkgs.kbd];
|
||||
|
||||
jobs = pkgs.lib.singleton {
|
||||
name = "kbd";
|
||||
jobs = singleton
|
||||
{ name = "kbd";
|
||||
|
||||
job = ''
|
||||
description "Keyboard / console initialisation"
|
||||
description = "Keyboard / console initialisation";
|
||||
|
||||
start on udev
|
||||
|
||||
script
|
||||
startOn = "udev";
|
||||
|
||||
preStart = ''
|
||||
export LANG=${defaultLocale}
|
||||
export LOCALE_ARCHIVE=/var/run/current-system/sw/lib/locale/locale-archive
|
||||
export PATH=${pkgs.gzip}/bin:$PATH # Needed by setfont
|
||||
|
@ -116,10 +115,8 @@ in
|
|||
|
||||
# Set the keymap.
|
||||
${pkgs.kbd}/bin/loadkeys '${consoleKeyMap}'
|
||||
|
||||
end script
|
||||
'';
|
||||
};
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -11,9 +11,7 @@ let
|
|||
backgrounds =
|
||||
let
|
||||
|
||||
specificThemes =
|
||||
config.services.ttyBackgrounds.defaultSpecificThemes
|
||||
++ config.services.ttyBackgrounds.specificThemes;
|
||||
specificThemes = config.services.ttyBackgrounds.specificThemes;
|
||||
|
||||
overridenTTYs = map (x: x.tty) specificThemes;
|
||||
|
||||
|
@ -24,8 +22,8 @@ let
|
|||
pkgs.lib.filter (x: !(pkgs.lib.elem x overridenTTYs)) requiredTTYs;
|
||||
|
||||
in
|
||||
(map (ttyNumber: {
|
||||
tty = ttyNumber;
|
||||
(map (tty: {
|
||||
inherit tty;
|
||||
theme = config.services.ttyBackgrounds.defaultTheme;
|
||||
}) defaultTTYs)
|
||||
++ specificThemes;
|
||||
|
@ -71,33 +69,10 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
defaultSpecificThemes = mkOption {
|
||||
default = [
|
||||
/*
|
||||
{ tty = 6;
|
||||
theme = pkgs.fetchurl { # Yeah!
|
||||
url = mirror://gentoo/distfiles/Theme-Pativo.tar.bz2;
|
||||
md5 = "9e13beaaadf88d43a5293e7ab757d569";
|
||||
};
|
||||
}
|
||||
*/
|
||||
{ tty = 10;
|
||||
theme = pkgs.themes "theme-gnu";
|
||||
}
|
||||
];
|
||||
description = ''
|
||||
This option sets specific themes for virtual consoles. If you
|
||||
just want to set themes for additional consoles, use
|
||||
<option>services.ttyBackgrounds.specificThemes</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
specificThemes = mkOption {
|
||||
default = [
|
||||
];
|
||||
default = [ ];
|
||||
description = ''
|
||||
This option allows you to set specific themes for virtual
|
||||
consoles.
|
||||
This option overrides the theme for specific virtual consoles.
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -115,6 +90,11 @@ in
|
|||
message = "kernelPackages.splashutils may not be false";
|
||||
};
|
||||
|
||||
services.ttyBackgrounds.specificThemes = singleton
|
||||
{ tty = config.services.syslogd.tty;
|
||||
theme = pkgs.themes "theme-gnu";
|
||||
};
|
||||
|
||||
environment.etc = singleton
|
||||
{ source = themesUnpacked;
|
||||
target = "splash";
|
||||
|
@ -136,24 +116,23 @@ in
|
|||
# For each console...
|
||||
for tty in ${toString (map (x: x.tty) backgrounds)}; do
|
||||
# Make sure that the console exists.
|
||||
echo -n "" > /dev/tty$tty
|
||||
echo -n "" > /dev/$tty
|
||||
|
||||
# Set the theme as determined by tty-backgrounds-combine.sh
|
||||
# above.
|
||||
# above. Note that splashutils needs a TTY number
|
||||
# instead of a device name, hence the ''${tty:3}.
|
||||
theme=$(readlink ${themesUnpacked}/$tty)
|
||||
${splashutils}/${splashutils.controlName} --tty $tty -c setcfg -t $theme || true
|
||||
${splashutils}/${splashutils.controlName} --tty $tty -c setpic -t $theme || true
|
||||
${splashutils}/${splashutils.controlName} --tty $tty -c on || true
|
||||
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setcfg -t $theme || true
|
||||
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setpic -t $theme || true
|
||||
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c on || true
|
||||
done
|
||||
'';
|
||||
|
||||
postStop =
|
||||
''
|
||||
/var/run/current-system/sw/bin/ps -axuw > /tmp/ps
|
||||
|
||||
# Disable the theme on each console.
|
||||
for tty in ${toString (map (x: x.tty) backgrounds)}; do
|
||||
${splashutils}/${splashutils.controlName} --tty $tty -c off || true
|
||||
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c off || true
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue