1 { stdenv, writeScriptBin, makeWrapper, lib, fetchurl, git, cacert, libpng, libjpeg, libwebp
2 , erlang, openssl, expat, libyaml, bash, gnused, gnugrep, coreutils, util-linux, procps, gd
3 , flock, autoreconfHook
8 , withSqlite ? false, sqlite
10 , withZlib ? true, zlib
13 , withImagemagick ? false, imagemagick
17 ctlpath = lib.makeBinPath [ bash gnused gnugrep gawk coreutils util-linux procps ];
18 in stdenv.mkDerivation rec {
22 nativeBuildInputs = [ makeWrapper autoreconfHook ];
24 buildInputs = [ erlang openssl expat libyaml gd ]
25 ++ lib.optional withSqlite sqlite
26 ++ lib.optional withPam pam
27 ++ lib.optional withZlib zlib
31 url = "https://www.process-one.net/downloads/downloads-action.php?file=/${version}/ejabberd-${version}.tar.gz";
32 hash = "sha256-DW5/DYLZHNqJ4lddmag1B0E9ov/eObIVGASUeioPolg=";
33 # remember to update the deps FOD hash & its pinned ejabberd-po commit
37 inherit (nixosTests) ejabberd;
40 deps = stdenv.mkDerivation {
41 pname = "ejabberd-deps";
46 # update: curl -L api.github.com/repos/processone/ejabberd-po/branches/main | jq .commit.sha -r
48 substituteInPlace rebar.config \
50 '{git, "https://github.com/processone/ejabberd-po", {branch, "main"}}' \
51 '{git, "https://github.com/processone/ejabberd-po", {tag, "26d6463386588d39f07027dabff3cb8dd938bf6b"}}'
54 configureFlags = [ "--enable-all" "--with-sqlite3=${sqlite.dev}" ];
57 git erlang openssl expat libyaml sqlite pam zlib autoreconfHook
60 GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
62 makeFlags = [ "deps" ];
69 git describe --always --tags > .rev
73 # not a typo; comes from `make deps`
81 # avoid /nix/store references in the source
82 dontPatchShebangs = true;
84 outputHashAlgo = "sha256";
85 outputHashMode = "recursive";
86 outputHash = "sha256-HrLu3wTF+cUxpGX0yK3nbB57SRM2ND3Crlxs5/8FIwI=";
90 (lib.enableFeature withMysql "mysql")
91 (lib.enableFeature withPgsql "pgsql")
92 (lib.enableFeature withSqlite "sqlite")
93 (lib.enableFeature withPam "pam")
94 (lib.enableFeature withZlib "zlib")
95 (lib.enableFeature withTools "tools")
96 (lib.enableFeature withRedis "redis")
97 ] ++ lib.optional withSqlite "--with-sqlite3=${sqlite.dev}";
99 enableParallelBuilding = true;
109 -e '2iexport PATH=${ctlpath}:$PATH' \
110 -e 's,\(^ *FLOCK=\).*,\1${flock}/bin/flock,' \
111 -e 's,\(^ *JOT=\).*,\1,' \
112 -e 's,\(^ *CONNLOCKDIR=\).*,\1/var/lock/ejabberdctl,' \
113 $out/sbin/ejabberdctl
114 wrapProgram $out/lib/eimp-*/priv/bin/eimp --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libpng libjpeg libwebp ]}"
115 ${lib.optionalString withImagemagick ''wrapProgram $out/lib/ejabberd-*/priv/bin/captcha.sh --prefix PATH : "${lib.makeBinPath [ imagemagick ]}"''}
116 rm $out/bin/{mix,iex,elixir}
120 description = "Open-source XMPP application server written in Erlang";
121 mainProgram = "ejabberdctl";
122 license = licenses.gpl2;
123 homepage = "https://www.ejabberd.im";
124 platforms = platforms.linux;
125 maintainers = with maintainers; [ sander abbradar ];