nixos/charybdis: implement reload functionality

IRC daemons are highly stateful daemons, so allow config changes without
kicking all server and client connections.

Basically a port of 60c62214f5.
This commit is contained in:
Martin Weinelt 2021-11-30 23:30:54 +01:00
parent ab5a3f8226
commit 1f726635ee

View File

@ -85,14 +85,21 @@ in
"d ${cfg.statedir} - ${cfg.user} ${cfg.group} - -" "d ${cfg.statedir} - ${cfg.user} ${cfg.group} - -"
]; ];
environment.etc."charybdis/ircd.conf".source = configFile;
systemd.services.charybdis = { systemd.services.charybdis = {
description = "Charybdis IRC daemon"; description = "Charybdis IRC daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
reloadIfChanged = true;
restartTriggers = [
configFile
];
environment = { environment = {
BANDB_DBPATH = "${cfg.statedir}/ban.db"; BANDB_DBPATH = "${cfg.statedir}/ban.db";
}; };
serviceConfig = { serviceConfig = {
ExecStart = "${charybdis}/bin/charybdis -foreground -logfile /dev/stdout -configfile ${configFile}"; ExecStart = "${charybdis}/bin/charybdis -foreground -logfile /dev/stdout -configfile /etc/charybdis/ircd.conf";
ExecReload = "${coreutils}/bin/kill -HUP $MAINPID";
Group = cfg.group; Group = cfg.group;
User = cfg.user; User = cfg.user;
}; };