blob: a8e16728d8ecbe6119244a66fb3cc19c746172ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.eternal-terminal;
in
{
###### interface
options = {
services.eternal-terminal = {
enable = lib.mkEnableOption "Eternal Terminal server";
port = lib.mkOption {
default = 2022;
type = lib.types.port;
description = ''
The port the server should listen on. Will use the server's default (2022) if not specified.
Make sure to open this port in the firewall if necessary.
'';
};
verbosity = lib.mkOption {
default = 0;
type = lib.types.enum (lib.range 0 9);
description = ''
The verbosity level (0-9).
'';
};
silent = lib.mkOption {
default = false;
type = lib.types.bool;
description = ''
If enabled, disables all logging.
'';
};
logSize = lib.mkOption {
default = 20971520;
type = lib.types.int;
description = ''
The maximum log size.
'';
};
telemetry = lib.mkOption {
default = false;
type = lib.types.bool;
description = ''
Collects anonymous usage data and crash reports.
'';
};
};
};
###### implementation
config = lib.mkIf cfg.enable {
# We need to ensure the et package is fully installed because
# the (remote) et client runs the `etterminal` binary when it
# connects.
environment.systemPackages = [ pkgs.eternal-terminal ];
systemd.services = {
eternal-terminal = {
description = "Eternal Terminal server.";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "exec";
ExecStart = "${pkgs.eternal-terminal}/bin/etserver --logtostdout --cfgfile=${pkgs.writeText "et.cfg" ''
; et.cfg : Config file for Eternal Terminal
;
[Networking]
port = ${toString cfg.port}
[Debug]
verbose = ${toString cfg.verbosity}
silent = ${if cfg.silent then "1" else "0"}
logsize = ${toString cfg.logSize}
telemetry = ${lib.boolToString cfg.telemetry}
''}";
Restart = "on-failure";
};
};
};
};
meta = {
maintainers = with lib.maintainers; [ tomasrivera ];
};
}
|