16 inherit (pkgs) coreutils charybdis;
17 cfg = config.services.charybdis;
19 configFile = pkgs.writeText "charybdis.conf" ''
30 services.charybdis = {
32 enable = mkEnableOption "Charybdis IRC daemon";
37 Charybdis IRC daemon configuration file.
43 default = "/var/lib/charybdis";
45 Location of the state directory of charybdis.
53 Charybdis IRC daemon user.
61 Charybdis IRC daemon group.
66 type = types.nullOr types.lines;
71 Charybdis will read its MOTD from /etc/charybdis/ircd.motd .
72 If set, the value of this option will be written to this path.
82 config = mkIf cfg.enable (
85 users.users.${cfg.user} = {
86 description = "Charybdis IRC daemon user";
87 uid = config.ids.uids.ircd;
91 users.groups.${cfg.group} = {
92 gid = config.ids.gids.ircd;
95 systemd.tmpfiles.settings."10-charybdis".${cfg.statedir}.d = {
96 inherit (cfg) user group;
99 environment.etc."charybdis/ircd.conf".source = configFile;
101 systemd.services.charybdis = {
102 description = "Charybdis IRC daemon";
103 wantedBy = [ "multi-user.target" ];
104 reloadIfChanged = true;
109 BANDB_DBPATH = "${cfg.statedir}/ban.db";
112 ExecStart = "${charybdis}/bin/charybdis -foreground -logfile /dev/stdout -configfile /etc/charybdis/ircd.conf";
113 ExecReload = "${coreutils}/bin/kill -HUP $MAINPID";
121 (mkIf (cfg.motd != null) {
122 environment.etc."charybdis/ircd.motd".text = cfg.motd;