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
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-09-25 20:55:08 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with 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
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-09-25 20:55:08 +01:00
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
2009-01-08 23:49:22 +00:00
|
|
|
options = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-06-10 13:53:45 +01:00
|
|
|
services.rogue.enable = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.bool;
|
2009-06-10 13:53:45 +01:00
|
|
|
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 {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.str;
|
2009-09-25 20:55:08 +01:00
|
|
|
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
|
|
|
|
2011-09-14 19:20:50 +01: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 ];
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2013-01-16 11:33:18 +00:00
|
|
|
systemd.services.rogue =
|
2009-10-12 18:27:57 +01:00
|
|
|
{ description = "Rogue dungeon crawling game";
|
2012-10-04 20:27:31 +01:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig =
|
|
|
|
{ ExecStart = "${pkgs.rogue}/bin/rogue";
|
|
|
|
StandardInput = "tty";
|
|
|
|
StandardOutput = "tty";
|
|
|
|
TTYPath = "/dev/${cfg.tty}";
|
|
|
|
TTYReset = true;
|
|
|
|
TTYVTDisallocate = true;
|
2015-06-17 14:39:12 +01:00
|
|
|
WorkingDirectory = "/tmp";
|
2012-10-04 21:15:10 +01:00
|
|
|
Restart = "always";
|
2012-10-04 20:27:31 +01:00
|
|
|
};
|
2009-09-25 20:55:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-01-08 23:49:22 +00:00
|
|
|
}
|