summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/ejabberd/default.nix
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2018-04-10 18:17:58 +0200
committerjeschli <jeschli@gmail.com>2018-04-10 18:17:58 +0200
commitab7b04f55e9eb331e5f9ed254843ed8e0bcf9d78 (patch)
tree3c5811972b7fb1c58dbcdc3ac5f52a6bcf9f492b /krebs/5pkgs/simple/ejabberd/default.nix
parent3f9cbbc8d1f5420ef276633f087e63f700c386e7 (diff)
parent5b8c4d24e274bbf26e85420fc11b5bf7e24ac22d (diff)
Merge branch 'master' of prism.r:stockholm
Diffstat (limited to 'krebs/5pkgs/simple/ejabberd/default.nix')
-rw-r--r--krebs/5pkgs/simple/ejabberd/default.nix118
1 files changed, 118 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/ejabberd/default.nix b/krebs/5pkgs/simple/ejabberd/default.nix
new file mode 100644
index 000000000..2799241fa
--- /dev/null
+++ b/krebs/5pkgs/simple/ejabberd/default.nix
@@ -0,0 +1,118 @@
+{ stdenv, writeScriptBin, lib, fetchurl, git, cacert
+, 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
+}:
+
+let
+ fakegit = writeScriptBin "git" ''
+ #! ${stdenv.shell} -e
+ if [ "$1" = "describe" ]; then
+ [ -r .rev ] && cat .rev || true
+ fi
+ '';
+
+ ctlpath = lib.makeBinPath [ bash gnused gnugrep coreutils utillinux procps ];
+
+in stdenv.mkDerivation rec {
+ version = "17.07";
+ name = "ejabberd-${version}";
+
+ src = fetchurl {
+ url = "http://www.process-one.net/downloads/ejabberd/${version}/${name}.tgz";
+ sha256 = "1p8ppp2czjgnq8xnhyksd82npvvx99fwr0g3rrq1wvnwh2vgb8km";
+ };
+
+ 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";
+
+ deps = stdenv.mkDerivation {
+ name = "ejabberd-deps-${version}";
+
+ inherit src;
+
+ configureFlags = [ "--enable-all" "--with-sqlite3=${sqlite.dev}" ];
+
+ buildInputs = [ git erlang openssl expat libyaml sqlite pam zlib elixir ];
+
+ GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
+
+ makeFlags = [ "deps" ];
+
+ phases = [ "unpackPhase" "configurePhase" "buildPhase" "installPhase" ];
+
+ installPhase = ''
+ for i in deps/*; do
+ ( cd $i
+ git reset --hard
+ git clean -ffdx
+ git describe --always --tags > .rev
+ rm -rf .git
+ )
+ done
+ rm deps/.got
+
+ cp -r deps $out
+ '';
+
+ outputHashMode = "recursive";
+ outputHashAlgo = "sha256";
+ outputHash = "1q9yzccn4zf5i4hibq1r0i34q4986a93ph4792l1ph07aiisc8p7";
+ };
+
+ configureFlags =
+ [ (lib.enableFeature withMysql "mysql")
+ (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.dev}";
+
+ enableParallelBuilding = true;
+
+ preBuild = ''
+ cp -r $deps deps
+ chmod -R +w deps
+ patchShebangs deps
+ '';
+
+ 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
+ '';
+
+ meta = {
+ description = "Open-source XMPP application server written in Erlang";
+ license = lib.licenses.gpl2;
+ homepage = http://www.ejabberd.im;
+ platforms = lib.platforms.linux;
+ maintainers = [ lib.maintainers.sander lib.maintainers.abbradar ];
+ broken = withElixir;
+ };
+}