2018-08-05 17:02:40 +01:00
|
|
|
{ stdenv, writeScriptBin, makeWrapper, lib, fetchurl, git, cacert, libpng, libjpeg, libwebp
|
2020-11-24 15:29:28 +00:00
|
|
|
, erlang, openssl, expat, libyaml, bash, gnused, gnugrep, coreutils, util-linux, procps, gd
|
2018-03-26 05:01:31 +01:00
|
|
|
, flock
|
2015-09-11 21:39:21 +01:00
|
|
|
, withMysql ? false
|
|
|
|
, withPgsql ? false
|
|
|
|
, withSqlite ? false, sqlite
|
|
|
|
, withPam ? false, pam
|
|
|
|
, withZlib ? true, zlib
|
|
|
|
, withIconv ? true
|
|
|
|
, withTools ? false
|
|
|
|
, withRedis ? false
|
|
|
|
}:
|
2008-01-23 18:11:03 +00:00
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
2020-11-24 15:29:28 +00:00
|
|
|
ctlpath = lib.makeBinPath [ bash gnused gnugrep coreutils util-linux procps ];
|
2015-09-11 21:39:21 +01:00
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2021-05-11 12:22:13 +01:00
|
|
|
version = "21.04";
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "ejabberd";
|
2015-09-11 21:39:21 +01:00
|
|
|
|
2009-11-17 16:54:04 +00:00
|
|
|
src = fetchurl {
|
2020-03-19 04:44:02 +00:00
|
|
|
url = "https://www.process-one.net/downloads/downloads-action.php?file=/${version}/${pname}-${version}.tgz";
|
2021-05-11 12:22:13 +01:00
|
|
|
sha256 = "09s8mj0dkvp9mxazsqxqqmnl5n2xyi8avx0rzgvqrbl3byanzfzr";
|
2008-01-23 18:11:03 +00:00
|
|
|
};
|
2015-09-11 21:39:21 +01:00
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
nativeBuildInputs = [ fakegit makeWrapper ];
|
2015-09-11 21:39:21 +01:00
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
buildInputs = [ erlang openssl expat libyaml gd ]
|
2015-09-11 21:39:21 +01:00
|
|
|
++ lib.optional withSqlite sqlite
|
|
|
|
++ lib.optional withPam pam
|
|
|
|
++ lib.optional withZlib zlib
|
2021-07-01 07:28:35 +01:00
|
|
|
;
|
2015-09-11 21:39:21 +01:00
|
|
|
|
2016-04-29 18:56:02 +01:00
|
|
|
deps = stdenv.mkDerivation {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "ejabberd-deps";
|
|
|
|
inherit version;
|
2016-04-29 18:56:02 +01:00
|
|
|
|
|
|
|
inherit src;
|
|
|
|
|
2016-08-23 01:36:14 +01:00
|
|
|
configureFlags = [ "--enable-all" "--with-sqlite3=${sqlite.dev}" ];
|
2016-04-29 18:56:02 +01:00
|
|
|
|
2021-07-01 07:28:35 +01:00
|
|
|
nativeBuildInputs = [ git erlang openssl expat libyaml sqlite pam zlib ];
|
2016-04-29 18:56:02 +01:00
|
|
|
|
|
|
|
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
|
|
|
|
|
|
|
makeFlags = [ "deps" ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
for i in deps/*; do
|
|
|
|
( cd $i
|
|
|
|
git reset --hard
|
2016-07-02 17:06:48 +01:00
|
|
|
git clean -ffdx
|
2016-04-29 18:56:02 +01:00
|
|
|
git describe --always --tags > .rev
|
|
|
|
rm -rf .git
|
|
|
|
)
|
|
|
|
done
|
2016-04-30 01:48:47 +01:00
|
|
|
rm deps/.got
|
2016-04-29 18:56:02 +01:00
|
|
|
|
|
|
|
cp -r deps $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputHashMode = "recursive";
|
|
|
|
outputHashAlgo = "sha256";
|
2021-05-11 12:22:13 +01:00
|
|
|
outputHash = "1mvixgb46ss35abjwz3lw38c69bii1xyj557a92bvrxc1gc6gx31";
|
2016-04-29 18:56:02 +01:00
|
|
|
};
|
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 withIconv "iconv")
|
|
|
|
(lib.enableFeature withTools "tools")
|
|
|
|
(lib.enableFeature withRedis "redis")
|
2016-04-16 18:47:23 +01:00
|
|
|
] ++ lib.optional withSqlite "--with-sqlite3=${sqlite.dev}";
|
2015-09-11 21:39:21 +01:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
preBuild = ''
|
2016-04-29 18:56:02 +01:00
|
|
|
cp -r $deps deps
|
|
|
|
chmod -R +w deps
|
2021-07-01 07:28:35 +01:00
|
|
|
patchShebangs .
|
2008-09-22 15:07:25 +01:00
|
|
|
'';
|
2015-09-11 21:39:21 +01:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
sed -i \
|
|
|
|
-e '2iexport PATH=${ctlpath}:$PATH' \
|
2018-03-26 05:01:31 +01:00
|
|
|
-e 's,\(^ *FLOCK=\).*,\1${flock}/bin/flock,' \
|
2015-09-11 21:39:21 +01:00
|
|
|
-e 's,\(^ *JOT=\).*,\1,' \
|
|
|
|
-e 's,\(^ *CONNLOCKDIR=\).*,\1/var/lock/ejabberdctl,' \
|
|
|
|
$out/sbin/ejabberdctl
|
2021-01-15 07:07:56 +00:00
|
|
|
wrapProgram $out/lib/eimp-*/priv/bin/eimp --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libpng libjpeg libwebp ]}"
|
2021-07-01 07:28:35 +01:00
|
|
|
rm $out/bin/{mix,iex,elixir}
|
2013-11-02 00:46:30 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2008-09-22 15:07:25 +01:00
|
|
|
description = "Open-source XMPP application server written in Erlang";
|
2018-02-25 17:17:51 +00:00
|
|
|
license = licenses.gpl2;
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.ejabberd.im";
|
2018-02-25 17:17:51 +00:00
|
|
|
platforms = platforms.linux;
|
2021-01-27 16:10:34 +00:00
|
|
|
maintainers = with maintainers; [ sander abbradar ];
|
2008-09-22 15:07:25 +01:00
|
|
|
};
|
2008-01-23 18:11:03 +00:00
|
|
|
}
|