1 { config, lib, options, pkgs, ... }: let
2 cfg = config.services.ergochat;
7 enable = lib.mkEnableOption "Ergo IRC daemon";
9 openFilesLimit = lib.mkOption {
13 Maximum number of open files. Limits the clients and server connections.
17 configFile = lib.mkOption {
18 type = lib.types.path;
19 default = (pkgs.formats.yaml {}).generate "ergo.conf" cfg.settings;
20 defaultText = lib.literalMD "generated config file from `settings`";
22 Path to configuration file.
23 Setting this will skip any configuration done via `settings`
27 settings = lib.mkOption {
28 type = (pkgs.formats.yaml {}).type;
30 Ergo IRC daemon configuration file.
31 https://raw.githubusercontent.com/ergochat/ergo/master/default.yaml
42 casemapping = "permissive";
44 lookup-hostnames = false;
48 forward-confirm-hostnames = false;
61 # this points to the StateDirectory of the systemd service
62 path = "/var/lib/ergo/ircd.db";
65 authentication-enabled = true;
68 allow-before-connect = true;
75 email-verification.enabled = false;
79 allowed-by-default = true;
80 always-on = "opt-out";
81 auto-away = "opt-out";
85 default-modes = "+ntC";
100 channel-length = 2048;
102 autoresize-window = "3d";
103 autoreplay-on-join = 0;
104 chathistory-maxmessages = 100;
105 znc-maxmessages = 2048;
108 query-cutoff = "none";
112 allow-individual-delete = false;
113 enable-account-indexing = false;
128 config = lib.mkIf cfg.enable {
130 environment.etc."ergo.yaml".source = cfg.configFile;
132 # merge configured values with default values
133 services.ergochat.settings =
134 lib.mapAttrsRecursive (_: lib.mkDefault) options.services.ergochat.settings.default;
136 systemd.services.ergochat = {
137 description = "Ergo IRC daemon";
138 wantedBy = [ "multi-user.target" ];
139 # reload is not applying the changed config. further investigation is needed
140 # at some point this should be enabled, since we don't want to restart for
141 # every config change
142 # reloadIfChanged = true;
143 restartTriggers = [ cfg.configFile ];
145 ExecStart = "${pkgs.ergochat}/bin/ergo run --conf /etc/ergo.yaml";
146 ExecReload = "${pkgs.util-linux}/bin/kill -HUP $MAINPID";
148 StateDirectory = "ergo";
149 LimitNOFILE = toString cfg.openFilesLimit;
154 meta.maintainers = with lib.maintainers; [ lassulus tv ];