summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/ejabberd
diff options
context:
space:
mode:
authornin <nin@c-base.org>2018-05-02 15:13:40 +0200
committernin <nin@c-base.org>2018-05-02 15:13:40 +0200
commit689fb1a77ad53722086da922de2de533460205b3 (patch)
tree408667e6aa15e1e0fa031e99c003c3968ba1578d /krebs/5pkgs/simple/ejabberd
parent702136442c5f8c4f7f1bb911bd21d238a164218a (diff)
parent37fa7bff9339799984554b8ccbacf1f07281d6ce (diff)
Merge branch 'master' of prism:stockholm
Diffstat (limited to 'krebs/5pkgs/simple/ejabberd')
-rw-r--r--krebs/5pkgs/simple/ejabberd/default.nix123
-rw-r--r--krebs/5pkgs/simple/ejabberd/ejabberdctl.patch32
2 files changed, 155 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..9e4ed3df5
--- /dev/null
+++ b/krebs/5pkgs/simple/ejabberd/default.nix
@@ -0,0 +1,123 @@
+{ stdenv, writeScriptBin, lib, fetchurl, git, cacert
+, erlang, openssl, expat, libyaml, bash, gnused, gnugrep, coreutils, utillinux, procps, gd
+, flock
+, 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 = "18.01";
+ name = "ejabberd-${version}";
+
+ src = fetchurl {
+ url = "http://www.process-one.net/downloads/ejabberd/${version}/${name}.tgz";
+ sha256 = "01i2n8mlgw293jdf4172f9q8ca8m35vysjws791p7nynpfdb4cn6";
+ };
+
+ nativeBuildInputs = [ fakegit ];
+
+ buildInputs = [ erlang openssl expat libyaml gd ]
+ ++ 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}" ];
+
+ nativeBuildInputs = [ 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 = "1v3h0c7kfifb6wsfxyv5j1wc7rlxbb7r0pgd4s340wiyxnllzzhk";
+ };
+
+ 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;
+
+ patches = [
+ ./ejabberdctl.patch
+ ];
+
+ preBuild = ''
+ cp -r $deps deps
+ chmod -R +w deps
+ patchShebangs deps
+ '';
+
+ postInstall = ''
+ sed -i \
+ -e '2iexport PATH=${ctlpath}:$PATH' \
+ -e 's,\(^ *FLOCK=\).*,\1${flock}/bin/flock,' \
+ -e 's,\(^ *JOT=\).*,\1,' \
+ -e 's,\(^ *CONNLOCKDIR=\).*,\1/var/lock/ejabberdctl,' \
+ $out/sbin/ejabberdctl
+ '';
+
+ meta = with stdenv.lib; {
+ description = "Open-source XMPP application server written in Erlang";
+ license = licenses.gpl2;
+ homepage = http://www.ejabberd.im;
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ sander abbradar ];
+ broken = withElixir;
+ };
+}
diff --git a/krebs/5pkgs/simple/ejabberd/ejabberdctl.patch b/krebs/5pkgs/simple/ejabberd/ejabberdctl.patch
new file mode 100644
index 000000000..f7c842b7b
--- /dev/null
+++ b/krebs/5pkgs/simple/ejabberd/ejabberdctl.patch
@@ -0,0 +1,32 @@
+--- a/ejabberdctl.template 1970-01-01 01:00:01.000000000 +0100
++++ b/ejabberdctl.template 2018-04-24 23:06:54.127715441 +0200
+@@ -42,19 +42,18 @@
+ esac
+
+ # parse command line parameters
+-for arg; do
+- case $arg in
+- -n|--node) ERLANG_NODE_ARG=$2; shift;;
+- -s|--spool) SPOOL_DIR=$2; shift;;
+- -l|--logs) LOGS_DIR=$2; shift;;
+- -f|--config) EJABBERD_CONFIG_PATH=$2; shift;;
+- -c|--ctl-config) EJABBERDCTL_CONFIG_PATH=$2; shift;;
+- -d|--config-dir) ETC_DIR=$2; shift;;
+- -t|--no-timeout) NO_TIMEOUT="--no-timeout";;
+- --) :;;
++while test $# -gt 0; do
++ case $1 in
++ -n|--node) ERLANG_NODE_ARG=$2; shift 2;;
++ -s|--spool) SPOOL_DIR=$2; shift 2;;
++ -l|--logs) LOGS_DIR=$2; shift 2;;
++ -f|--config) EJABBERD_CONFIG_PATH=$2; shift 2;;
++ -c|--ctl-config) EJABBERDCTL_CONFIG_PATH=$2; shift 2;;
++ -d|--config-dir) ETC_DIR=$2; shift 2;;
++ -t|--no-timeout) NO_TIMEOUT="--no-timeout"; shift 1;;
++ # --) :;; what is this for?
+ *) break;;
+ esac
+- shift
+ done
+
+ # define ejabberd variables if not already defined from the command line