2e751c0772
the conversion procedure is simple: - find all things that look like options, ie calls to either `mkOption` or `lib.mkOption` that take an attrset. remember the attrset as the option - for all options, find a `description` attribute who's value is not a call to `mdDoc` or `lib.mdDoc` - textually convert the entire value of the attribute to MD with a few simple regexes (the set from mdize-module.sh) - if the change produced a change in the manual output, discard - if the change kept the manual unchanged, add some text to the description to make sure we've actually found an option. if the manual changes this time, keep the converted description this procedure converts 80% of nixos options to markdown. around 2000 options remain to be inspected, but most of those fail the "does not change the manual output check": currently the MD conversion process does not faithfully convert docbook tags like <code> and <package>, so any option using such tags will not be converted at all.
96 lines
2.1 KiB
Nix
96 lines
2.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.eternal-terminal;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.eternal-terminal = {
|
|
|
|
enable = mkEnableOption "Eternal Terminal server";
|
|
|
|
port = mkOption {
|
|
default = 2022;
|
|
type = types.int;
|
|
description = lib.mdDoc ''
|
|
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 = mkOption {
|
|
default = 0;
|
|
type = types.enum (lib.range 0 9);
|
|
description = lib.mdDoc ''
|
|
The verbosity level (0-9).
|
|
'';
|
|
};
|
|
|
|
silent = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = lib.mdDoc ''
|
|
If enabled, disables all logging.
|
|
'';
|
|
};
|
|
|
|
logSize = mkOption {
|
|
default = 20971520;
|
|
type = types.int;
|
|
description = lib.mdDoc ''
|
|
The maximum log size.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
###### implementation
|
|
|
|
config = 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 = "forking";
|
|
ExecStart = "${pkgs.eternal-terminal}/bin/etserver --daemon --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}
|
|
''}";
|
|
Restart = "on-failure";
|
|
KillMode = "process";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
maintainers = with lib.maintainers; [ ];
|
|
};
|
|
}
|