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