2009-10-12 17:36:19 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2008-03-03 19:28:10 +00:00
|
|
|
|
|
|
|
let
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
inherit (pkgs) jre openfire coreutils which gnugrep gawk gnused;
|
|
|
|
|
|
|
|
startDependency =
|
|
|
|
if config.services.openfire.usePostgreSQL then "postgresql" else
|
|
|
|
if config.services.gw6c.enable then "gw6c" else
|
|
|
|
"network-interfaces";
|
|
|
|
|
2009-03-06 12:27:05 +00:00
|
|
|
in
|
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
{
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.openfire = {
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "
|
|
|
|
Whether to enable OpenFire XMPP server.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
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 17:36:19 +01:00
|
|
|
};
|
2009-04-30 03:29:58 +01:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
};
|
2009-04-30 03:29:58 +01:00
|
|
|
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
###### implementation
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
config = mkIf config.services.openfire.enable {
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
assertions = singleton
|
|
|
|
{ assertion = !(config.services.openfire.usePostgreSQL -> config.services.postgresql.enable);
|
|
|
|
message = "openfire assertion failed";
|
|
|
|
};
|
|
|
|
|
2009-10-12 19:09:34 +01:00
|
|
|
jobs.openfire =
|
2009-10-12 17:36:19 +01:00
|
|
|
{ description = "OpenFire XMPP server";
|
|
|
|
|
2009-11-06 22:19:17 +00:00
|
|
|
startOn = "started ${startDependency}";
|
2009-03-06 12:27:05 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
script =
|
|
|
|
''
|
2009-03-06 12:27:05 +00:00
|
|
|
export PATH=${jre}/bin:${openfire}/bin:${coreutils}/bin:${which}/bin:${gnugrep}/bin:${gawk}/bin:${gnused}/bin
|
|
|
|
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
|
2009-10-12 17:36:19 +01:00
|
|
|
''; # */
|
|
|
|
};
|
|
|
|
|
2009-03-06 12:27:05 +00:00
|
|
|
};
|
2009-10-12 17:36:19 +01:00
|
|
|
|
2008-03-03 19:28:10 +00:00
|
|
|
}
|