2009-09-25 20:55:08 +01:00
|
|
|
# Execute the game `rogue' on tty 9. Mostly used by the NixOS
|
|
|
|
# installation CD.
|
2009-01-08 23:49:22 +00:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-01-08 23:49:22 +00:00
|
|
|
|
|
|
|
let
|
2009-06-10 13:53:45 +01:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
cfg = config.services.rogue;
|
|
|
|
|
|
|
|
in
|
2009-06-10 13:53:45 +01:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
2009-01-08 23:49:22 +00:00
|
|
|
options = {
|
2009-06-10 13:53:45 +01:00
|
|
|
|
|
|
|
services.rogue.enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable the Rogue game on one of the virtual
|
|
|
|
consoles.
|
|
|
|
'';
|
2009-01-08 23:49:22 +00:00
|
|
|
};
|
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
services.rogue.tty = mkOption {
|
|
|
|
default = "tty9";
|
2009-06-10 13:53:45 +01:00
|
|
|
description = ''
|
|
|
|
Virtual console on which to run Rogue.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2009-01-08 23:49:22 +00:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
|
|
|
|
###### implementation
|
2009-01-08 23:49:22 +00:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
config = mkIf cfg.enable {
|
2009-01-08 23:49:22 +00:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
boot.extraTTYs = [ cfg.tty ];
|
2009-01-08 23:49:22 +00:00
|
|
|
|
2009-10-12 19:09:34 +01:00
|
|
|
jobs.rogue =
|
2009-10-12 18:27:57 +01:00
|
|
|
{ description = "Rogue dungeon crawling game";
|
2009-06-10 13:34:58 +01:00
|
|
|
|
2009-11-06 22:19:17 +00:00
|
|
|
startOn = "started udev";
|
2009-06-10 13:53:45 +01:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
extraConfig = "chdir /root";
|
2009-06-08 23:44:59 +01:00
|
|
|
|
2009-10-15 15:02:24 +01:00
|
|
|
exec = "${pkgs.rogue}/bin/rogue < /dev/${cfg.tty} > /dev/${cfg.tty} 2>&1";
|
2009-09-25 20:55:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
services.ttyBackgrounds.specificThemes = singleton
|
|
|
|
{ tty = cfg.tty;
|
|
|
|
theme = pkgs.themes "theme-gnu";
|
|
|
|
};
|
2009-06-08 23:44:59 +01:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
};
|
|
|
|
|
2009-01-08 23:49:22 +00:00
|
|
|
}
|