2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-10-12 16:36:19 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2008-03-03 19:28:10 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
services.openfire = {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable OpenFire XMPP server.
|
|
|
|
";
|
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
usePostgreSQL = mkOption {
|
|
|
|
default = true;
|
|
|
|
description = "
|
|
|
|
Whether you use PostgreSQL service for your storage back-end.
|
|
|
|
";
|
|
|
|
};
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
};
|
2009-04-30 02:29:58 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
};
|
2009-04-30 02:29:58 +00:00
|
|
|
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
###### implementation
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2013-10-30 17:30:23 +00:00
|
|
|
config = mkIf config.services.openfire.enable {
|
|
|
|
|
|
|
|
assertions = singleton
|
|
|
|
{ assertion = !(config.services.openfire.usePostgreSQL -> config.services.postgresql.enable);
|
|
|
|
message = "OpenFire assertion failed.";
|
|
|
|
};
|
2009-10-12 16:36:19 +00:00
|
|
|
|
2016-01-06 06:50:18 +00:00
|
|
|
systemd.services.openfire = {
|
|
|
|
description = "OpenFire XMPP server";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "networking.target" ] ++
|
|
|
|
optional config.services.openfire.usePostgreSQL "postgresql.service";
|
|
|
|
path = with pkgs; [ jre openfire coreutils which gnugrep gawk gnused ];
|
|
|
|
script = ''
|
|
|
|
export HOME=/tmp
|
|
|
|
mkdir /var/log/openfire || true
|
|
|
|
mkdir /etc/openfire || true
|
|
|
|
for i in ${openfire}/conf.inst/*; do
|
|
|
|
if ! test -f /etc/openfire/$(basename $i); then
|
|
|
|
cp $i /etc/openfire/
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
openfire start
|
|
|
|
''; # */
|
|
|
|
};
|
2013-10-30 17:30:23 +00:00
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2008-03-03 19:28:10 +00:00
|
|
|
}
|