Convert "ejabbered" (untested)
svn path=/nixos/branches/fix-style/; revision=14378
This commit is contained in:
parent
931f68c924
commit
0c7129316c
@ -480,33 +480,6 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ejabberd = {
|
|
||||||
enable = mkOption {
|
|
||||||
default = false;
|
|
||||||
description = "Whether to enable ejabberd server";
|
|
||||||
};
|
|
||||||
|
|
||||||
spoolDir = mkOption {
|
|
||||||
default = "/var/lib/ejabberd";
|
|
||||||
description = "Location of the spooldir of ejabberd";
|
|
||||||
};
|
|
||||||
|
|
||||||
logsDir = mkOption {
|
|
||||||
default = "/var/log/ejabberd";
|
|
||||||
description = "Location of the logfile directory of ejabberd";
|
|
||||||
};
|
|
||||||
|
|
||||||
confDir = mkOption {
|
|
||||||
default = "/var/ejabberd";
|
|
||||||
description = "Location of the config directory of ejabberd";
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualHosts = mkOption {
|
|
||||||
default = "\"localhost\"";
|
|
||||||
description = "Virtualhosts that ejabberd should host. Hostnames are surrounded with doublequotes and separated by commas";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
jboss = {
|
jboss = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
@ -1369,6 +1342,7 @@ in
|
|||||||
(import ../upstart-jobs/portmap.nix)
|
(import ../upstart-jobs/portmap.nix)
|
||||||
(import ../upstart-jobs/bitlbee.nix)
|
(import ../upstart-jobs/bitlbee.nix)
|
||||||
(import ../upstart-jobs/gnunet.nix)
|
(import ../upstart-jobs/gnunet.nix)
|
||||||
|
(import ../upstart-jobs/ejabberd.nix) # untested, dosen't compile on x86_64-linux
|
||||||
|
|
||||||
# nix
|
# nix
|
||||||
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
(import ../upstart-jobs/nix.nix) # nix options and daemon
|
||||||
|
@ -168,12 +168,6 @@ let
|
|||||||
inherit config pkgs;
|
inherit config pkgs;
|
||||||
})
|
})
|
||||||
|
|
||||||
# EJabberd service
|
|
||||||
++ optional config.services.ejabberd.enable
|
|
||||||
(import ../upstart-jobs/ejabberd.nix {
|
|
||||||
inherit config pkgs;
|
|
||||||
})
|
|
||||||
|
|
||||||
# OpenFire XMPP server
|
# OpenFire XMPP server
|
||||||
++ optional config.services.openfire.enable
|
++ optional config.services.openfire.enable
|
||||||
(import ../upstart-jobs/openfire.nix {
|
(import ../upstart-jobs/openfire.nix {
|
||||||
|
@ -1,36 +1,85 @@
|
|||||||
args: with args;
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib) mkOption mkIf;
|
||||||
|
|
||||||
|
options = {
|
||||||
|
services = {
|
||||||
|
ejabberd = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
description = "Whether to enable ejabberd server";
|
||||||
|
};
|
||||||
|
|
||||||
|
spoolDir = mkOption {
|
||||||
|
default = "/var/lib/ejabberd";
|
||||||
|
description = "Location of the spooldir of ejabberd";
|
||||||
|
};
|
||||||
|
|
||||||
|
logsDir = mkOption {
|
||||||
|
default = "/var/log/ejabberd";
|
||||||
|
description = "Location of the logfile directory of ejabberd";
|
||||||
|
};
|
||||||
|
|
||||||
|
confDir = mkOption {
|
||||||
|
default = "/var/ejabberd";
|
||||||
|
description = "Location of the config directory of ejabberd";
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualHosts = mkOption {
|
||||||
|
default = "\"localhost\"";
|
||||||
|
description = "Virtualhosts that ejabberd should host. Hostnames are surrounded with doublequotes and separated by commas";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.services.ejabberd;
|
cfg = config.services.ejabberd;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
|
||||||
name = "ejabberd";
|
|
||||||
|
|
||||||
job = ''
|
|
||||||
description "EJabberd server"
|
|
||||||
|
|
||||||
start on network-interface/started
|
mkIf config.services.ejabberd.enable {
|
||||||
stop on network-interfaces/stop
|
|
||||||
|
require = [
|
||||||
start script
|
options
|
||||||
# Initialise state data
|
];
|
||||||
mkdir -p ${cfg.logsDir}
|
|
||||||
|
|
||||||
if ! test -d ${cfg.spoolDir}
|
services = {
|
||||||
then
|
extraJobs = [{
|
||||||
cp -av ${pkgs.ejabberd}/var/lib/ejabberd /var/lib
|
name = "ejabberd";
|
||||||
fi
|
|
||||||
|
job = ''
|
||||||
mkdir -p ${cfg.confDir}
|
description "EJabberd server"
|
||||||
sed -e 's|{hosts, \["localhost"\]}.|{hosts, \[${cfg.virtualHosts}\]}.|' ${pkgs.ejabberd}/etc/ejabberd/ejabberd.cfg > ${cfg.confDir}/ejabberd.cfg
|
|
||||||
end script
|
start on network-interface/started
|
||||||
|
stop on network-interfaces/stop
|
||||||
|
|
||||||
respawn ${pkgs.bash}/bin/sh -c 'export PATH=$PATH:${pkgs.ejabberd}/sbin; cd ~; ejabberdctl --logs ${cfg.logsDir} --spool ${cfg.spoolDir} --config ${cfg.confDir}/ejabberd.cfg start; sleep 1d'
|
start script
|
||||||
|
# Initialise state data
|
||||||
stop script
|
mkdir -p ${cfg.logsDir}
|
||||||
${pkgs.ejabberd}/sbin/ejabberdctl stop
|
|
||||||
end script
|
if ! test -d ${cfg.spoolDir}
|
||||||
'';
|
then
|
||||||
|
cp -av ${pkgs.ejabberd}/var/lib/ejabberd /var/lib
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${cfg.confDir}
|
||||||
|
sed -e 's|{hosts, \["localhost"\]}.|{hosts, \[${cfg.virtualHosts}\]}.|' ${pkgs.ejabberd}/etc/ejabberd/ejabberd.cfg > ${cfg.confDir}/ejabberd.cfg
|
||||||
|
end script
|
||||||
|
|
||||||
|
respawn ${pkgs.bash}/bin/sh -c 'export PATH=$PATH:${pkgs.ejabberd}/sbin; cd ~; ejabberdctl --logs ${cfg.logsDir} --spool ${cfg.spoolDir} --config ${cfg.confDir}/ejabberd.cfg start; sleep 1d'
|
||||||
|
|
||||||
|
stop script
|
||||||
|
${pkgs.ejabberd}/sbin/ejabberdctl stop
|
||||||
|
end script
|
||||||
|
'';
|
||||||
|
}];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user