1 { config, lib, pkgs, ... }:
4 inherit (lib) mkEnableOption mkIf mkOption singleton types;
5 inherit (pkgs) coreutils charybdis;
6 cfg = config.services.charybdis;
8 configFile = pkgs.writeText "charybdis.conf" ''
19 services.charybdis = {
21 enable = mkEnableOption "Charybdis IRC daemon";
26 Charybdis IRC daemon configuration file.
32 default = "/var/lib/charybdis";
34 Location of the state directory of charybdis.
42 Charybdis IRC daemon user.
50 Charybdis IRC daemon group.
55 type = types.nullOr types.lines;
60 Charybdis will read its MOTD from /etc/charybdis/ircd.motd .
61 If set, the value of this option will be written to this path.
72 config = mkIf cfg.enable (lib.mkMerge [
74 users.users.${cfg.user} = {
75 description = "Charybdis IRC daemon user";
76 uid = config.ids.uids.ircd;
80 users.groups.${cfg.group} = {
81 gid = config.ids.gids.ircd;
84 systemd.tmpfiles.settings."10-charybdis".${cfg.statedir}.d = {
85 inherit (cfg) user group;
88 environment.etc."charybdis/ircd.conf".source = configFile;
90 systemd.services.charybdis = {
91 description = "Charybdis IRC daemon";
92 wantedBy = [ "multi-user.target" ];
93 reloadIfChanged = true;
98 BANDB_DBPATH = "${cfg.statedir}/ban.db";
101 ExecStart = "${charybdis}/bin/charybdis -foreground -logfile /dev/stdout -configfile /etc/charybdis/ircd.conf";
102 ExecReload = "${coreutils}/bin/kill -HUP $MAINPID";
110 (mkIf (cfg.motd != null) {
111 environment.etc."charybdis/ircd.motd".text = cfg.motd;