1# Execute the game `rogue' on tty 9. Mostly used by the NixOS
2# installation CD.
3
4{ config, lib, pkgs, ... }:
5
6with lib;
7
8let
9
10 cfg = config.services.rogue;
11
12in
13
14{
15 ###### interface
16
17 options = {
18
19 services.rogue.enable = mkOption {
20 type = types.bool;
21 default = false;
22 description = ''
23 Whether to enable the Rogue game on one of the virtual
24 consoles.
25 '';
26 };
27
28 services.rogue.tty = mkOption {
29 type = types.str;
30 default = "tty9";
31 description = ''
32 Virtual console on which to run Rogue.
33 '';
34 };
35
36 };
37
38
39 ###### implementation
40
41 config = mkIf cfg.enable {
42
43 boot.extraTTYs = [ cfg.tty ];
44
45 systemd.services.rogue =
46 { description = "Rogue dungeon crawling game";
47 wantedBy = [ "multi-user.target" ];
48 serviceConfig =
49 { ExecStart = "${pkgs.rogue}/bin/rogue";
50 StandardInput = "tty";
51 StandardOutput = "tty";
52 TTYPath = "/dev/${cfg.tty}";
53 TTYReset = true;
54 TTYVTDisallocate = true;
55 WorkingDirectory = "/tmp";
56 Restart = "always";
57 };
58 };
59
60 };
61
62}