ejabberd: handle optional deps

This commit is contained in:
Chuang Zhu
2024-07-19 03:00:09 +08:00
parent 6f5510289e
commit 90484c7f68
2 changed files with 110 additions and 18 deletions
+30 -8
View File
@@ -13,6 +13,8 @@
, withSqlite ? false, sqlite
, withPam ? false, pam
, withZlib ? true, zlib
, withSip ? false
, withLua ? false
, withTools ? false
, withRedis ? false
, withImagemagick ? false, imagemagick
@@ -42,7 +44,7 @@ let
beamDeps = [ ];
};
beamDeps = import ./rebar-deps.nix { # TODO(@chuangzhu) add updateScript
allBeamDeps = import ./rebar-deps.nix { # TODO(@chuangzhu) add updateScript
inherit fetchHex fetchgit fetchFromGitHub;
builder = lib.makeOverridable beamPackages.buildRebar3;
@@ -56,10 +58,6 @@ let
buildInputs = [ gd libwebp libpng libjpeg ];
buildPlugins = [ beamPackages.pc ];
};
ezlib = prev.ezlib.override {
buildInputs = [ zlib ];
buildPlugins = [ beamPackages.pc ];
};
fast_tls = prev.fast_tls.override {
buildInputs = [ openssl ];
buildPlugins = [ beamPackages.pc ];
@@ -75,9 +73,26 @@ let
xmpp = prev.xmpp.override {
buildPlugins = [ beamPackages.pc provider_asn1 ];
};
# Optional deps
sqlite3 = prev.sqlite3.override {
buildInputs = [ sqlite ];
buildPlugins = [ beamPackages.pc ];
};
p1_mysql = prev.p1_acme.override { buildPlugins = [ beamPackages.pc ]; };
epam = prev.epam.override {
buildInputs = [ pam ];
buildPlugins = [ beamPackages.pc ];
};
esip = prev.esip.override { buildPlugins = [ beamPackages.pc ]; };
ezlib = prev.ezlib.override {
buildInputs = [ zlib ];
buildPlugins = [ beamPackages.pc ];
};
};
};
beamDeps = builtins.removeAttrs allBeamDeps [ "sqlite3" "p1_pgsql" "p1_mysql" "luerl" "esip" "eredis" "epam" "ezlib" ];
in stdenv.mkDerivation rec {
pname = "ejabberd";
version = "24.02";
@@ -90,9 +105,14 @@ in stdenv.mkDerivation rec {
buildInputs = [ erlang ]
++ builtins.attrValues beamDeps
++ lib.optional withSqlite sqlite
++ lib.optional withPam pam
++ lib.optional withZlib zlib
++ lib.optional withMysql allBeamDeps.p1_mysql
++ lib.optional withPgsql allBeamDeps.p1_pgsql
++ lib.optional withSqlite allBeamDeps.sqlite3
++ lib.optional withPam allBeamDeps.epam
++ lib.optional withZlib allBeamDeps.ezlib
++ lib.optional withSip allBeamDeps.esip
++ lib.optional withLua allBeamDeps.luerl
++ lib.optional withRedis allBeamDeps.eredis
;
src = fetchurl {
@@ -111,6 +131,8 @@ in stdenv.mkDerivation rec {
(lib.enableFeature withSqlite "sqlite")
(lib.enableFeature withPam "pam")
(lib.enableFeature withZlib "zlib")
(lib.enableFeature withSip "sip")
(lib.enableFeature withLua "lua")
(lib.enableFeature withTools "tools")
(lib.enableFeature withRedis "redis")
] ++ lib.optional withSqlite "--with-sqlite3=${sqlite.dev}";
+80 -10
View File
@@ -14,16 +14,6 @@ let
};
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";
@@ -64,6 +54,16 @@ let
};
beamDeps = [ p1_utils ];
};
sqlite3 = builder {
name = "sqlite3";
version = "1.1.14";
src = fetchHex {
pkg = "sqlite3";
version = "1.1.14";
sha256 = "sha256-hQVLbKKXNDwVntZ5Skc/8sjuq9hUtv4C9xHAv9NzzoY=";
};
beamDeps = [ ];
};
pkix = builder {
name = "pkix";
version = "1.0.9";
@@ -84,6 +84,16 @@ let
};
beamDeps = [ ];
};
p1_pgsql = builder {
name = "p1_pgsql";
version = "1.1.25";
src = fetchHex {
pkg = "p1_pgsql";
version = "1.1.25";
sha256 = "sha256-tlTB4H0+d1tia0B+dpbKz9iNF76D5xaLnYnDgy2RPec=";
};
beamDeps = [ xmpp ];
};
p1_oauth2 = builder {
name = "p1_oauth2";
version = "0.6.14";
@@ -94,6 +104,16 @@ let
};
beamDeps = [ ];
};
p1_mysql = builder {
name = "p1_mysql";
version = "1.0.23";
src = fetchHex {
pkg = "p1_mysql";
version = "1.0.23";
sha256 = "sha256-nO+YJl+yhzdOe2S/QCLE317GYZbKMc9L7XPGfEW/gk4=";
};
beamDeps = [ ];
};
p1_acme = builder {
name = "p1_acme";
version = "1.0.22";
@@ -114,6 +134,16 @@ let
};
beamDeps = [ p1_utils ];
};
luerl = builder {
name = "luerl";
version = "1.1.1";
src = fetchHex {
pkg = "luerl";
version = "1.1.1";
sha256 = "sha256-4X7yRqf/h27JDmh5KjlwiXlBYATU6s/op2QyBrlHB3M=";
};
beamDeps = [ ];
};
jose = builder {
name = "jose";
version = "1.11.5";
@@ -174,6 +204,46 @@ let
};
beamDeps = [ p1_utils ];
};
ezlib = builder {
name = "ezlib";
version = "1.0.12";
src = fetchHex {
pkg = "ezlib";
version = "1.0.12";
sha256 = "sha256-MOlDVftCJgqrbhJYLLDFa/IzUV5lXIrq9Idg51YeTrs=";
};
beamDeps = [ p1_utils ];
};
esip = builder {
name = "esip";
version = "1.0.52";
src = fetchHex {
pkg = "esip";
version = "1.0.52";
sha256 = "sha256-bwAWU5WQBQCqJizgKXFi2Tkxx4wUZNif0O3G49a8AR8=";
};
beamDeps = [ fast_tls p1_utils stun ];
};
eredis = builder {
name = "eredis";
version = "1.2.0";
src = fetchHex {
pkg = "eredis";
version = "1.2.0";
sha256 = "sha256-2bWr7ywsirqPMqoBggPgs9yLEVd3OyVKsdTCACMX8eE=";
};
beamDeps = [ ];
};
epam = builder {
name = "epam";
version = "1.0.14";
src = fetchHex {
pkg = "epam";
version = "1.0.14";
sha256 = "sha256-LzRJ5yiFpypsKoQ/VhrdD8L3DXoh9hRWkwpUdHPU2Yk=";
};
beamDeps = [ ];
};
eimp = builder {
name = "eimp";
version = "1.0.22";