charybdis service: add option to configure MOTD (#25512)
Read MOTD files from /etc/charybdis.
This commit is contained in:
parent
dd2b1744ba
commit
b3b2431932
@ -51,6 +51,17 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
motd = mkOption {
|
||||||
|
type = types.nullOr types.lines;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Charybdis MOTD text.
|
||||||
|
|
||||||
|
Charybdis will read its MOTD from /etc/charybdis/ircd.motd .
|
||||||
|
If set, the value of this option will be written to this path.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -58,39 +69,42 @@ in
|
|||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable (lib.mkMerge [
|
||||||
|
{
|
||||||
users.extraUsers = singleton {
|
users.extraUsers = singleton {
|
||||||
name = cfg.user;
|
name = cfg.user;
|
||||||
description = "Charybdis IRC daemon user";
|
description = "Charybdis IRC daemon user";
|
||||||
uid = config.ids.uids.ircd;
|
uid = config.ids.uids.ircd;
|
||||||
group = cfg.group;
|
group = cfg.group;
|
||||||
};
|
|
||||||
|
|
||||||
users.extraGroups = singleton {
|
|
||||||
name = cfg.group;
|
|
||||||
gid = config.ids.gids.ircd;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.charybdis = {
|
|
||||||
description = "Charybdis IRC daemon";
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
environment = {
|
|
||||||
BANDB_DBPATH = "${cfg.statedir}/ban.db";
|
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
|
||||||
ExecStart = "${charybdis}/bin/charybdis-ircd -foreground -logfile /dev/stdout -configfile ${configFile}";
|
users.extraGroups = singleton {
|
||||||
Group = cfg.group;
|
name = cfg.group;
|
||||||
User = cfg.user;
|
gid = config.ids.gids.ircd;
|
||||||
PermissionsStartOnly = true; # preStart needs to run with root permissions
|
|
||||||
};
|
};
|
||||||
preStart = ''
|
|
||||||
${coreutils}/bin/mkdir -p ${cfg.statedir}
|
|
||||||
${coreutils}/bin/chown ${cfg.user}:${cfg.group} ${cfg.statedir}
|
|
||||||
'';
|
|
||||||
|
|
||||||
};
|
systemd.services.charybdis = {
|
||||||
|
description = "Charybdis IRC daemon";
|
||||||
};
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
environment = {
|
||||||
|
BANDB_DBPATH = "${cfg.statedir}/ban.db";
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${charybdis}/bin/charybdis-ircd -foreground -logfile /dev/stdout -configfile ${configFile}";
|
||||||
|
Group = cfg.group;
|
||||||
|
User = cfg.user;
|
||||||
|
PermissionsStartOnly = true; # preStart needs to run with root permissions
|
||||||
|
};
|
||||||
|
preStart = ''
|
||||||
|
${coreutils}/bin/mkdir -p ${cfg.statedir}
|
||||||
|
${coreutils}/bin/chown ${cfg.user}:${cfg.group} ${cfg.statedir}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
(mkIf (cfg.motd != null) {
|
||||||
|
environment.etc."charybdis/ircd.motd".text = cfg.motd;
|
||||||
|
})
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ stdenv.mkDerivation rec {
|
|||||||
"--enable-ipv6"
|
"--enable-ipv6"
|
||||||
"--enable-openssl=${openssl.dev}"
|
"--enable-openssl=${openssl.dev}"
|
||||||
"--with-program-prefix=charybdis-"
|
"--with-program-prefix=charybdis-"
|
||||||
|
"--sysconfdir=/etc/charybdis"
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [ bison flex openssl ];
|
buildInputs = [ bison flex openssl ];
|
||||||
|
Loading…
Reference in New Issue
Block a user