* 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
|
with pkgs.lib;
|
||||||
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
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
syslogConf = pkgs.writeText "syslog.conf" ''
|
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.
|
# Send emergency messages to all users.
|
||||||
*.emerg *
|
*.emerg *
|
||||||
@ -46,24 +24,42 @@ let
|
|||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
require = [
|
###### interface
|
||||||
options
|
|
||||||
];
|
|
||||||
|
|
||||||
services = {
|
options = {
|
||||||
extraJobs = [{
|
|
||||||
name = "syslogd";
|
services.syslogd = {
|
||||||
|
|
||||||
job = ''
|
|
||||||
description "Syslog daemon"
|
|
||||||
|
|
||||||
start on udev
|
|
||||||
stop on shutdown
|
|
||||||
|
|
||||||
env TZ=${config.time.timeZone}
|
tty = mkOption {
|
||||||
|
default = "tty10";
|
||||||
respawn ${pkgs.sysklogd}/sbin/syslogd -n -f ${syslogConf}
|
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
|
{ config, pkgs, ... }:
|
||||||
# Originally used only by installation CD
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (pkgs.lib) mkOption;
|
cfg = config.services.rogue;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
###### interface
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
services.rogue.enable = mkOption {
|
services.rogue.enable = mkOption {
|
||||||
@ -17,43 +24,40 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
services.rogue.ttyNumber = mkOption {
|
services.rogue.tty = mkOption {
|
||||||
default = "9";
|
default = "tty9";
|
||||||
description = ''
|
description = ''
|
||||||
Virtual console on which to run Rogue.
|
Virtual console on which to run Rogue.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
cfg = config.services.rogue;
|
###### implementation
|
||||||
|
|
||||||
in
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
pkgs.lib.mkIf cfg.enable {
|
boot.extraTTYs = [ cfg.tty ];
|
||||||
require = [options];
|
|
||||||
|
|
||||||
boot.extraTTYs = [cfg.ttyNumber];
|
|
||||||
|
|
||||||
services.extraJobs = pkgs.lib.singleton
|
jobs = singleton
|
||||||
{ name = "rogue";
|
{ name = "rogue";
|
||||||
|
|
||||||
job = ''
|
description = "Rogue dungeon crawling game";
|
||||||
description "Rogue dungeon crawling game"
|
|
||||||
|
|
||||||
start on udev
|
|
||||||
stop on shutdown
|
|
||||||
|
|
||||||
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
|
exec = "${pkgs.rogue}/bin/rogue < /dev/{cfg.tty} > /dev/{cfg.tty} 2>&1";
|
||||||
{ tty = cfg.ttyNumber;
|
};
|
||||||
theme = pkgs.themes "theme-gnu";
|
|
||||||
};
|
|
||||||
|
|
||||||
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, ...}:
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
# think about where to put this chunk of code!
|
# think about where to put this chunk of code!
|
||||||
# required by other pieces as well
|
# required by other pieces as well
|
||||||
requiredTTYs = config.services.mingetty.ttys
|
requiredTTYs = config.services.mingetty.ttys
|
||||||
++ config.boot.extraTTYs
|
++ config.boot.extraTTYs
|
||||||
++ [config.services.syslogd.tty];
|
++ [ config.services.syslogd.tty ];
|
||||||
ttyNumbers = requiredTTYs;
|
ttys = map (dev: "/dev/${dev}") requiredTTYs;
|
||||||
ttys = map (nr: "/dev/tty" + toString nr) ttyNumbers;
|
|
||||||
defaultLocale = config.i18n.defaultLocale;
|
defaultLocale = config.i18n.defaultLocale;
|
||||||
consoleFont = config.i18n.consoleFont;
|
consoleFont = config.i18n.consoleFont;
|
||||||
consoleKeyMap = config.i18n.consoleKeyMap;
|
consoleKeyMap = config.i18n.consoleKeyMap;
|
||||||
@ -22,21 +23,21 @@ in
|
|||||||
|
|
||||||
# most options are defined in i18n.nix
|
# most options are defined in i18n.nix
|
||||||
|
|
||||||
boot.extraTTYs = pkgs.lib.mkOption {
|
boot.extraTTYs = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
example = [8 9];
|
example = ["tty8" "tty9"];
|
||||||
description = "
|
description = ''
|
||||||
Tty (virtual console) devices, in addition to the consoles on
|
Tty (virtual console) devices, in addition to the consoles on
|
||||||
which mingetty and syslogd run, that must be initialised.
|
which mingetty and syslogd run, that must be initialised.
|
||||||
Only useful if you have some program that you want to run on
|
Only useful if you have some program that you want to run on
|
||||||
some fixed console. For example, the NixOS installation CD
|
some fixed console. For example, the NixOS installation CD
|
||||||
opens the manual in a web browser on console 7, so it sets
|
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
|
# dummy option so that requiredTTYs can be passed
|
||||||
requiredTTYs = pkgs.lib.mkOption {
|
requiredTTYs = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
description = "
|
description = "
|
||||||
FIXME: find another place for this option.
|
FIXME: find another place for this option.
|
||||||
@ -55,16 +56,14 @@ in
|
|||||||
|
|
||||||
environment.systemPackages = [pkgs.kbd];
|
environment.systemPackages = [pkgs.kbd];
|
||||||
|
|
||||||
jobs = pkgs.lib.singleton {
|
jobs = singleton
|
||||||
name = "kbd";
|
{ name = "kbd";
|
||||||
|
|
||||||
job = ''
|
description = "Keyboard / console initialisation";
|
||||||
description "Keyboard / console initialisation"
|
|
||||||
|
|
||||||
start on udev
|
startOn = "udev";
|
||||||
|
|
||||||
script
|
|
||||||
|
|
||||||
|
preStart = ''
|
||||||
export LANG=${defaultLocale}
|
export LANG=${defaultLocale}
|
||||||
export LOCALE_ARCHIVE=/var/run/current-system/sw/lib/locale/locale-archive
|
export LOCALE_ARCHIVE=/var/run/current-system/sw/lib/locale/locale-archive
|
||||||
export PATH=${pkgs.gzip}/bin:$PATH # Needed by setfont
|
export PATH=${pkgs.gzip}/bin:$PATH # Needed by setfont
|
||||||
@ -116,10 +115,8 @@ in
|
|||||||
|
|
||||||
# Set the keymap.
|
# Set the keymap.
|
||||||
${pkgs.kbd}/bin/loadkeys '${consoleKeyMap}'
|
${pkgs.kbd}/bin/loadkeys '${consoleKeyMap}'
|
||||||
|
'';
|
||||||
end script
|
};
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@ let
|
|||||||
backgrounds =
|
backgrounds =
|
||||||
let
|
let
|
||||||
|
|
||||||
specificThemes =
|
specificThemes = config.services.ttyBackgrounds.specificThemes;
|
||||||
config.services.ttyBackgrounds.defaultSpecificThemes
|
|
||||||
++ config.services.ttyBackgrounds.specificThemes;
|
|
||||||
|
|
||||||
overridenTTYs = map (x: x.tty) specificThemes;
|
overridenTTYs = map (x: x.tty) specificThemes;
|
||||||
|
|
||||||
@ -24,8 +22,8 @@ let
|
|||||||
pkgs.lib.filter (x: !(pkgs.lib.elem x overridenTTYs)) requiredTTYs;
|
pkgs.lib.filter (x: !(pkgs.lib.elem x overridenTTYs)) requiredTTYs;
|
||||||
|
|
||||||
in
|
in
|
||||||
(map (ttyNumber: {
|
(map (tty: {
|
||||||
tty = ttyNumber;
|
inherit tty;
|
||||||
theme = config.services.ttyBackgrounds.defaultTheme;
|
theme = config.services.ttyBackgrounds.defaultTheme;
|
||||||
}) defaultTTYs)
|
}) defaultTTYs)
|
||||||
++ specificThemes;
|
++ 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 {
|
specificThemes = mkOption {
|
||||||
default = [
|
default = [ ];
|
||||||
];
|
|
||||||
description = ''
|
description = ''
|
||||||
This option allows you to set specific themes for virtual
|
This option overrides the theme for specific virtual consoles.
|
||||||
consoles.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,6 +90,11 @@ in
|
|||||||
message = "kernelPackages.splashutils may not be false";
|
message = "kernelPackages.splashutils may not be false";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.ttyBackgrounds.specificThemes = singleton
|
||||||
|
{ tty = config.services.syslogd.tty;
|
||||||
|
theme = pkgs.themes "theme-gnu";
|
||||||
|
};
|
||||||
|
|
||||||
environment.etc = singleton
|
environment.etc = singleton
|
||||||
{ source = themesUnpacked;
|
{ source = themesUnpacked;
|
||||||
target = "splash";
|
target = "splash";
|
||||||
@ -136,24 +116,23 @@ in
|
|||||||
# For each console...
|
# For each console...
|
||||||
for tty in ${toString (map (x: x.tty) backgrounds)}; do
|
for tty in ${toString (map (x: x.tty) backgrounds)}; do
|
||||||
# Make sure that the console exists.
|
# 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
|
# 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)
|
theme=$(readlink ${themesUnpacked}/$tty)
|
||||||
${splashutils}/${splashutils.controlName} --tty $tty -c setcfg -t $theme || true
|
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setcfg -t $theme || true
|
||||||
${splashutils}/${splashutils.controlName} --tty $tty -c setpic -t $theme || true
|
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c setpic -t $theme || true
|
||||||
${splashutils}/${splashutils.controlName} --tty $tty -c on || true
|
${splashutils}/${splashutils.controlName} --tty ''${tty:3} -c on || true
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postStop =
|
postStop =
|
||||||
''
|
''
|
||||||
/var/run/current-system/sw/bin/ps -axuw > /tmp/ps
|
|
||||||
|
|
||||||
# Disable the theme on each console.
|
# Disable the theme on each console.
|
||||||
for tty in ${toString (map (x: x.tty) backgrounds)}; do
|
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
|
done
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user