2009-09-25 21:55:08 +02:00
|
|
|
# Execute the game `rogue' on tty 9. Mostly used by the NixOS
|
|
|
|
# installation CD.
|
2009-01-09 00:49:22 +01:00
|
|
|
|
2009-09-25 21:55:08 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-01-09 00:49:22 +01:00
|
|
|
|
|
|
|
let
|
2009-06-10 14:53:45 +02:00
|
|
|
|
2009-09-25 21:55:08 +02:00
|
|
|
cfg = config.services.rogue;
|
|
|
|
|
|
|
|
in
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-09-25 21:55:08 +02:00
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
2009-01-09 00:49:22 +01:00
|
|
|
options = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-06-10 14:53:45 +02:00
|
|
|
services.rogue.enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable the Rogue game on one of the virtual
|
|
|
|
consoles.
|
|
|
|
'';
|
2009-01-09 00:49:22 +01:00
|
|
|
};
|
|
|
|
|
2009-09-25 21:55:08 +02:00
|
|
|
services.rogue.tty = mkOption {
|
|
|
|
default = "tty9";
|
2009-06-10 14:53:45 +02:00
|
|
|
description = ''
|
|
|
|
Virtual console on which to run Rogue.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2009-01-09 00:49:22 +01:00
|
|
|
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-09-25 21:55:08 +02:00
|
|
|
###### implementation
|
2009-01-09 00:49:22 +01:00
|
|
|
|
2009-09-25 21:55:08 +02:00
|
|
|
config = mkIf cfg.enable {
|
2009-01-09 00:49:22 +01:00
|
|
|
|
2009-09-25 21:55:08 +02:00
|
|
|
boot.extraTTYs = [ cfg.tty ];
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2012-10-04 21:27:31 +02:00
|
|
|
boot.systemd.services.rogue =
|
2009-10-12 19:27:57 +02:00
|
|
|
{ description = "Rogue dungeon crawling game";
|
2012-10-04 21:27:31 +02:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig =
|
|
|
|
{ ExecStart = "${pkgs.rogue}/bin/rogue";
|
|
|
|
StandardInput = "tty";
|
|
|
|
StandardOutput = "tty";
|
|
|
|
TTYPath = "/dev/${cfg.tty}";
|
|
|
|
TTYReset = true;
|
|
|
|
TTYVTDisallocate = true;
|
2012-10-04 22:15:10 +02:00
|
|
|
Restart = "always";
|
2012-10-04 21:27:31 +02:00
|
|
|
};
|
2009-09-25 21:55:08 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
services.ttyBackgrounds.specificThemes = singleton
|
|
|
|
{ tty = cfg.tty;
|
|
|
|
theme = pkgs.themes "theme-gnu";
|
|
|
|
};
|
2009-06-09 00:44:59 +02:00
|
|
|
|
2009-09-25 21:55:08 +02:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-01-09 00:49:22 +01:00
|
|
|
}
|