diff options
| author | Emily <vcs@emily.moe> | 2023-07-24 23:10:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-24 23:10:15 +0100 |
| commit | 03b811d7c9b280205510dcea205dfad41df12bd4 (patch) | |
| tree | 7b2ec5e8074354db00ea426f270985d9ab1fec43 /modules | |
| parent | 0f9058e739dbefc676dee557b4b627962268d556 (diff) | |
| parent | c4a1a1c458b70156f85b2529dc5113c21f832916 (diff) | |
Merge pull request #745 from ryane/eternal-terminal-module
eternal-terminal: add module
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/module-list.nix | 1 | ||||
| -rw-r--r-- | modules/services/eternal-terminal.nix | 91 |
2 files changed, 92 insertions, 0 deletions
diff --git a/modules/module-list.nix b/modules/module-list.nix index 582421b..3cb92ba 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -53,6 +53,7 @@ ./services/cachix-agent.nix ./services/dnsmasq.nix ./services/emacs.nix + ./services/eternal-terminal.nix ./services/gitlab-runner.nix ./services/hercules-ci-agent ./services/ipfs.nix diff --git a/modules/services/eternal-terminal.nix b/modules/services/eternal-terminal.nix new file mode 100644 index 0000000..d778fa0 --- /dev/null +++ b/modules/services/eternal-terminal.nix @@ -0,0 +1,91 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.services.eternal-terminal; +in { + options = { + services.eternal-terminal = { + + enable = mkEnableOption (lib.mdDoc "Eternal Terminal server"); + + package = mkOption { + type = types.path; + default = pkgs.eternal-terminal; + defaultText = "pkgs.eternal-terminal"; + description = lib.mdDoc + "This option specifies the eternal-terminal package to use."; + }; + + port = mkOption { + default = 2022; + type = types.port; + 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. + ''; + }; + }; + }; + + 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 = [ cfg.package ]; + + launchd.daemons.eternal-terminal = { + path = [ cfg.package ]; + serviceConfig = { + ProgramArguments = [ + "${cfg.package}/bin/etserver" + "--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} + '' + }" + ]; + KeepAlive = false; + RunAtLoad = true; + HardResourceLimits.NumberOfFiles = 4096; + SoftResourceLimits.NumberOfFiles = 4096; + }; + }; + }; + meta.maintainers = [ lib.maintainers.ryane or "ryane" ]; +} |
