nixpkgs/pkgs/servers/xmpp/ejabberd/default.nix

123 lines
3.1 KiB
Nix
Raw Normal View History

2016-04-29 18:56:02 +01:00
{ stdenv, writeScriptBin, lib, fetchurl, fetchFromGitHub, git, cacert
2015-09-11 21:39:21 +01:00
, erlang, openssl, expat, libyaml, bash, gnused, gnugrep, coreutils, utillinux, procps
, withMysql ? false
, withPgsql ? false
, withSqlite ? false, sqlite
, withPam ? false, pam
, withZlib ? true, zlib
, withRiak ? false
, withElixir ? false, elixir
, withIconv ? true
, withTools ? false
, withRedis ? false
}:
2015-09-11 21:39:21 +01:00
let
fakegit = writeScriptBin "git" ''
2016-02-10 23:36:09 +00:00
#! ${stdenv.shell} -e
if [ "$1" = "describe" ]; then
[ -r .rev ] && cat .rev || true
fi
2015-09-11 21:39:21 +01:00
'';
2016-04-29 18:56:02 +01:00
ctlpath = lib.makeBinPath [ bash gnused gnugrep coreutils utillinux procps ];
2015-09-11 21:39:21 +01:00
in stdenv.mkDerivation rec {
2016-04-29 18:56:02 +01:00
version = "16.04";
2013-11-02 00:46:30 +00:00
name = "ejabberd-${version}";
2015-09-11 21:39:21 +01:00
src = fetchurl {
2013-11-02 00:46:30 +00:00
url = "http://www.process-one.net/downloads/ejabberd/${version}/${name}.tgz";
2016-04-29 18:56:02 +01:00
sha256 = "1hrcswk03x5x6f6xy8sac4ihhi6jcmsfp6449k3570j39vklz5ix";
};
2015-09-11 21:39:21 +01:00
nativeBuildInputs = [ fakegit ];
buildInputs = [ erlang openssl expat libyaml ]
++ lib.optional withSqlite sqlite
++ lib.optional withPam pam
++ lib.optional withZlib zlib
++ lib.optional withElixir elixir
;
# Apparently needed for Elixir
LANG = "en_US.UTF-8";
2016-04-29 18:56:02 +01:00
deps = stdenv.mkDerivation {
name = "ejabberd-deps-${version}";
inherit src;
configureFlags = [ "--enable-all" "--with-sqlite3=${sqlite}" ];
buildInputs = [ git erlang openssl expat libyaml sqlite pam zlib elixir ];
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
preBuild = ''
patchShebangs .
'';
makeFlags = [ "deps" ];
installPhase = ''
for i in deps/*; do
( cd $i
git reset --hard
git clean -fdx
git describe --always --tags > .rev
rm -rf .git
)
done
cp -r deps $out
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "0kmk22z1r9c23j9hh91975pqh3jkh7z6i1gnmw4qxr8alcnpr75f";
};
2015-09-11 21:39:21 +01:00
configureFlags =
2016-02-10 23:36:09 +00:00
[ (lib.enableFeature withMysql "mysql")
2015-09-11 21:39:21 +01:00
(lib.enableFeature withPgsql "pgsql")
(lib.enableFeature withSqlite "sqlite")
(lib.enableFeature withPam "pam")
(lib.enableFeature withZlib "zlib")
(lib.enableFeature withRiak "riak")
(lib.enableFeature withElixir "elixir")
(lib.enableFeature withIconv "iconv")
(lib.enableFeature withTools "tools")
(lib.enableFeature withRedis "redis")
] ++ lib.optional withSqlite "--with-sqlite3=${sqlite}";
enableParallelBuilding = true;
preBuild = ''
2016-04-29 18:56:02 +01:00
cp -r $deps deps
chmod -R +w deps
2016-02-10 23:36:09 +00:00
for i in deps/*; do
[ -x "$i/configure" ] && ( cd "$i"; ./configure ) || true
done
'';
2015-09-11 21:39:21 +01:00
postInstall = ''
sed -i \
-e '2iexport PATH=${ctlpath}:$PATH' \
-e 's,\(^ *FLOCK=\).*,\1${utillinux}/bin/flock,' \
-e 's,\(^ *JOT=\).*,\1,' \
-e 's,\(^ *CONNLOCKDIR=\).*,\1/var/lock/ejabberdctl,' \
$out/sbin/ejabberdctl
2013-11-02 00:46:30 +00:00
'';
meta = {
description = "Open-source XMPP application server written in Erlang";
2016-03-03 14:00:54 +00:00
license = lib.licenses.gpl2;
homepage = http://www.ejabberd.im;
2016-03-03 14:00:54 +00:00
platforms = lib.platforms.linux;
maintainers = [ lib.maintainers.sander lib.maintainers.abbradar ];
2016-04-29 18:56:02 +01:00
broken = withElixir;
};
}