-
-
Save chuangzhu/e40c9cde919925fba25a3cb4da514e9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./result/bin/ejabberdctl help | |
{"init terminating in do_boot",{undef,[{ejabberd_ctl,start,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}} | |
init terminating in do_boot ({undef,[{ejabberd_ctl,start,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}) | |
Crash dump is being written to: /nix/store/lq8mxfyqd9cbyiz9xcplzxdiay0khmd1-ejabberd-24.02/var/log/ejabberd/erl_crash_20240419-155348.dump... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, writeScriptBin, makeWrapper, lib, fetchurl, git, cacert, libpng, libjpeg, libwebp | |
, erlang, openssl, expat, libyaml, bash, gnused, gnugrep, coreutils, util-linux, procps, gd | |
, flock, autoreconfHook | |
, gawk | |
, rebar3WithPlugins | |
, fetchFromGitHub | |
, fetchgit | |
, fetchHex | |
, beamPackages | |
, nixosTests | |
, withMysql ? false | |
, withPgsql ? false | |
, withSqlite ? false, sqlite | |
, withPam ? false, pam | |
, withZlib ? true, zlib | |
, withTools ? false | |
, withRedis ? false | |
, withImagemagick ? false, imagemagick | |
}: | |
let | |
ctlpath = lib.makeBinPath [ bash gnused gnugrep gawk coreutils util-linux procps ]; | |
provider_asn1 = beamPackages.buildRebar3 { | |
name = "provider_asn1"; | |
version = "0.3.0"; | |
src = fetchHex { | |
pkg = "provider_asn1"; | |
version = "0.3.0"; | |
sha256 = "sha256-MuelWYZi01rBut8jM6a5alMZizPGZoBE/LveSRu/+wU="; | |
}; | |
beamDeps = [ ]; | |
}; | |
rebar3_hex = beamPackages.buildRebar3 { | |
name = "rebar3_hex"; | |
version = "7.0.7"; | |
src = fetchHex { | |
pkg = "rebar3_hex"; | |
version = "7.0.7"; | |
sha256 = "sha256-1S2igSwiInATUgULZ1E6e2dK6YI5gvRffHRfF1Gg5Ok="; | |
}; | |
beamDeps = [ ]; | |
}; | |
beamDeps = import ./rebar-deps.nix { # TODO(@chuangzhu) add updateScript | |
inherit fetchHex fetchgit fetchFromGitHub; | |
builder = lib.makeOverridable beamPackages.buildRebar3; | |
overrides = final: prev: { | |
jiffy = prev.jiffy.override { buildPlugins = [ beamPackages.pc ]; }; | |
cache_tab = prev.cache_tab.override { buildPlugins = [ beamPackages.pc ]; }; | |
mqtree = prev.mqtree.override { buildPlugins = [ beamPackages.pc ]; }; | |
eimp = prev.eimp.override { buildPlugins = [ beamPackages.pc ]; }; | |
stringprep = prev.stringprep.override { buildPlugins = [ beamPackages.pc ]; }; | |
fast_yaml = prev.fast_yaml.override { buildPlugins = [ beamPackages.pc ]; }; | |
fast_tls = prev.fast_tls.override { buildPlugins = [ beamPackages.pc ]; }; | |
p1_acme = prev.p1_acme.override { buildPlugins = [ beamPackages.pc ]; }; | |
ezlib = prev.ezlib.override { | |
buildInputs = [ zlib ]; | |
buildPlugins = [ beamPackages.pc ]; | |
}; | |
fast_xml = prev.fast_xml.override { | |
buildInputs = [ expat ]; | |
buildPlugins = [ beamPackages.pc ]; | |
}; | |
xmpp = prev.xmpp.override { | |
buildPlugins = [ beamPackages.pc provider_asn1 ]; | |
}; | |
}; | |
}; | |
copylib = lib.concatMapStringsSep "\n" (package: "cp -R --preserve=mode ${package}/lib/erlang/lib/* $out/lib/") (builtins.attrValues beamDeps); | |
in stdenv.mkDerivation rec { | |
pname = "ejabberd"; | |
version = "24.02"; | |
nativeBuildInputs = [ | |
makeWrapper | |
autoreconfHook | |
(rebar3WithPlugins { plugins = [ provider_asn1 rebar3_hex ]; }) | |
]; | |
buildInputs = [ erlang openssl expat libyaml gd ] | |
++ builtins.attrValues beamDeps | |
++ lib.optional withSqlite sqlite | |
++ lib.optional withPam pam | |
++ lib.optional withZlib zlib | |
; | |
src = fetchurl { | |
url = "https://www.process-one.net/downloads/downloads-action.php?file=/${version}/ejabberd-${version}.tar.gz"; | |
hash = "sha256-ttSNO/K+82jpMh41Q2OByG14REuQQmScbEqrAIk5XAc="; | |
# remember to update the deps FOD hash & its pinned ejabberd-po commit | |
}; | |
passthru.tests = { | |
inherit (nixosTests) ejabberd; | |
}; | |
configureFlags = [ | |
(lib.enableFeature withMysql "mysql") | |
(lib.enableFeature withPgsql "pgsql") | |
(lib.enableFeature withSqlite "sqlite") | |
(lib.enableFeature withPam "pam") | |
(lib.enableFeature withZlib "zlib") | |
(lib.enableFeature withTools "tools") | |
(lib.enableFeature withRedis "redis") | |
] ++ lib.optional withSqlite "--with-sqlite3=${sqlite.dev}"; | |
enableParallelBuilding = true; | |
postPatch = '' | |
patchShebangs . | |
mkdir -p _build/default/lib | |
touch _build/default/lib/.got | |
touch _build/default/lib/.built | |
''; | |
REBAR_IGNORE_DEPS = 1; | |
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,' \ | |
-e "s,\(^ *ERL_LIBS=.*\),\1:$ERL_LIBS," \ | |
$out/sbin/ejabberdctl | |
# wrapProgram $out/lib/eimp-*/priv/bin/eimp --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libpng libjpeg libwebp ]}" | |
${lib.optionalString withImagemagick ''wrapProgram $out/lib/ejabberd-*/priv/bin/captcha.sh --prefix PATH : "${lib.makeBinPath [ imagemagick ]}"''} | |
''; | |
meta = with lib; { | |
description = "Open-source XMPP application server written in Erlang"; | |
mainProgram = "ejabberdctl"; | |
license = licenses.gpl2; | |
homepage = "https://www.ejabberd.im"; | |
platforms = platforms.linux; | |
maintainers = with maintainers; [ sander abbradar ]; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generated by rebar3_nix | |
let fetchOnly = { src, ... }: src; | |
in { builder ? fetchOnly, fetchHex, fetchgit, fetchFromGitHub, overrides ? (x: y: { }) }: | |
let | |
self = packages // (overrides self packages); | |
packages = with self; { | |
unicode_util_compat = builder { | |
name = "unicode_util_compat"; | |
version = "0.4.1"; | |
src = fetchHex { | |
pkg = "unicode_util_compat"; | |
version = "0.4.1"; | |
sha256 = "sha256-HRhIxASHzbCzDo7ZdeNOAlhgwC5BnLYV0lWEnzQnQ50="; | |
}; | |
beamDeps = [ ]; | |
}; | |
ezlib = builder { | |
name = "ezlib"; | |
version = "1.0.12"; | |
src = fetchHex { | |
pkg = "ezlib"; | |
version = "1.0.12"; | |
sha256 = "sha256-MOlDVftCJgqrbhJYLLDFa/IzUV5lXIrq9Idg51YeTrs="; | |
}; | |
beamDeps = [ p1_utils ]; | |
}; | |
yconf = builder { | |
name = "yconf"; | |
version = "1.0.15"; | |
src = fetchHex { | |
pkg = "yconf"; | |
version = "1.0.15"; | |
sha256 = "sha256-f/KrJNPJgzhCcWuaqqAaj5ZkGnaVy7cBsDRFxN7wERc="; | |
}; | |
beamDeps = [ fast_yaml ]; | |
}; | |
xmpp = builder { | |
name = "xmpp"; | |
version = "1.8.1"; | |
src = fetchHex { | |
pkg = "xmpp"; | |
version = "1.8.1"; | |
sha256 = "sha256-MtSjCKZhPk5BVfpOguzNyIMwltD6jZnI1CjIAGEeWdM="; | |
}; | |
beamDeps = [ ezlib fast_tls fast_xml idna p1_utils stringprep ]; | |
}; | |
stun = builder { | |
name = "stun"; | |
version = "1.2.12"; | |
src = fetchHex { | |
pkg = "stun"; | |
version = "1.2.12"; | |
sha256 = "sha256-ogVQMrbTONBFQUIAS8sS+vsMZKsfJz8dDGkj67yO3kA="; | |
}; | |
beamDeps = [ fast_tls p1_utils ]; | |
}; | |
stringprep = builder { | |
name = "stringprep"; | |
version = "1.0.29"; | |
src = fetchHex { | |
pkg = "stringprep"; | |
version = "1.0.29"; | |
sha256 = "sha256-ko66MEwwBusVEhEOvXuH2xY7AIWaCTdaHkRmFSxsRio="; | |
}; | |
beamDeps = [ p1_utils ]; | |
}; | |
pkix = builder { | |
name = "pkix"; | |
version = "1.0.9"; | |
src = fetchHex { | |
pkg = "pkix"; | |
version = "1.0.9"; | |
sha256 = "sha256-2qssCc3U7aBcm0WlwA6ZShpfJ2NJKeE3fi5ZtwcQPjo="; | |
}; | |
beamDeps = [ ]; | |
}; | |
p1_utils = builder { | |
name = "p1_utils"; | |
version = "1.0.25"; | |
src = fetchHex { | |
pkg = "p1_utils"; | |
version = "1.0.25"; | |
sha256 = "sha256-khkhRCjyxuXTGH/465qHg2lcJCdCC+miWYQOB62jKEc="; | |
}; | |
beamDeps = [ ]; | |
}; | |
p1_oauth2 = builder { | |
name = "p1_oauth2"; | |
version = "0.6.14"; | |
src = fetchHex { | |
pkg = "p1_oauth2"; | |
version = "0.6.14"; | |
sha256 = "sha256-H9OsR05Dci2dWofG34029pjth697uBy7tmNhRR2Zro8="; | |
}; | |
beamDeps = [ ]; | |
}; | |
p1_acme = builder { | |
name = "p1_acme"; | |
version = "1.0.22"; | |
src = fetchHex { | |
pkg = "p1_acme"; | |
version = "1.0.22"; | |
sha256 = "sha256-wrJaeylaQ12sTyeKc9hBf/KwAgxF4Wg1BOhpLvA+IFc="; | |
}; | |
beamDeps = [ base64url idna jiffy jose yconf ]; | |
}; | |
mqtree = builder { | |
name = "mqtree"; | |
version = "1.0.16"; | |
src = fetchHex { | |
pkg = "mqtree"; | |
version = "1.0.16"; | |
sha256 = "sha256-yH0clVddtlrym3lcnao77UP1wb+EByp0RpZZvPU1lOs="; | |
}; | |
beamDeps = [ p1_utils ]; | |
}; | |
jose = builder { | |
name = "jose"; | |
version = "1.11.5"; | |
src = fetchHex { | |
pkg = "jose"; | |
version = "1.11.5"; | |
sha256 = "sha256-3NOyFbr+Aup8WyPa/T64Bipc2PLZBP2cqjI9NwNKs4Q="; | |
}; | |
beamDeps = [ ]; | |
}; | |
jiffy = builder { | |
name = "jiffy"; | |
version = "1.1.1"; | |
src = fetchHex { | |
pkg = "jiffy"; | |
version = "1.1.1"; | |
sha256 = "sha256-YuHwWBw8GcM6clx4HfqIQQ2L/xu6/DiFolUihrR4XEw="; | |
}; | |
beamDeps = [ ]; | |
}; | |
idna = builder { | |
name = "idna"; | |
version = "6.0.0"; | |
src = fetchHex { | |
pkg = "idna"; | |
version = "6.0.0"; | |
sha256 = "sha256-S90wXrZOGLAnOGSSBpXLGNeiAh8xoRucX7zZolP5NuI="; | |
}; | |
beamDeps = [ unicode_util_compat ]; | |
}; | |
fast_yaml = builder { | |
name = "fast_yaml"; | |
version = "1.0.36"; | |
src = fetchHex { | |
pkg = "fast_yaml"; | |
version = "1.0.36"; | |
sha256 = "sha256-Gr6PdY/CqGsI7f+Au8aHz9QevBQSz+wO9KCs/NAyBS8="; | |
}; | |
beamDeps = [ p1_utils ]; | |
}; | |
fast_xml = builder { | |
name = "fast_xml"; | |
version = "1.1.51"; | |
src = fetchHex { | |
pkg = "fast_xml"; | |
version = "1.1.51"; | |
sha256 = "sha256-f85Bt9GkukOKLXoIjavnSjygc58a8qvLd+Ytr0PgQJo="; | |
}; | |
beamDeps = [ p1_utils ]; | |
}; | |
fast_tls = builder { | |
name = "fast_tls"; | |
version = "1.1.19"; | |
src = fetchHex { | |
pkg = "fast_tls"; | |
version = "1.1.19"; | |
sha256 = "sha256-2zQyLIeC1MUTnMuAcJ2OyMOAibRCYu3QwvZgrElb04k="; | |
}; | |
beamDeps = [ p1_utils ]; | |
}; | |
eimp = builder { | |
name = "eimp"; | |
version = "1.0.22"; | |
src = fetchHex { | |
pkg = "eimp"; | |
version = "1.0.22"; | |
sha256 = "sha256-s7n/sdml9KK6iKxBioGRZJMtmp06L8PTLKM4zoVcQ5I="; | |
}; | |
beamDeps = [ p1_utils ]; | |
}; | |
cache_tab = builder { | |
name = "cache_tab"; | |
version = "1.0.30"; | |
src = fetchHex { | |
pkg = "cache_tab"; | |
version = "1.0.30"; | |
sha256 = "sha256-bYpeANj4TEJidwam2+2wLjTVhJXz7WGTXIR1ygUxzaA="; | |
}; | |
beamDeps = [ p1_utils ]; | |
}; | |
base64url = builder { | |
name = "base64url"; | |
version = "1.0.1"; | |
src = fetchHex { | |
pkg = "base64url"; | |
version = "1.0.1"; | |
sha256 = "sha256-+bOt1HMaAqmwQQOYtHWzPnVmppU2Ujemve4btEdxn1w="; | |
}; | |
beamDeps = [ ]; | |
}; | |
}; | |
in self |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment