Skip to content

Commit 8e64623

Browse files
committed
ejabberd: hack to build with newly-added assets deps for mod_invites
This should be optional, but instead Bootstrap + jQuery are added to as dependency for building Ejabberd. jQuery is no longer a dependency of Bootstrap so it should be gone. The docs allow you to opt out of mod_invites or point to your own endpoint but the dependencies are now mistakenly required. The script to get the dependencies fetches with cURL which won’t run in the sandbox. Since SRIs are required for the runtime, it also means we can _only_ use this specific version of Bootstrap too.
1 parent 0a8fd93 commit 8e64623

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

pkgs/by-name/ej/ejabberd/package.nix

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
autoreconfHook,
1919
gawk,
2020
fetchFromGitHub,
21+
fetchurl,
2122
fetchgit,
2223
beamPackages,
2324
nixosTests,
@@ -35,6 +36,7 @@
3536
withRedis ? false,
3637
withImagemagick ? false,
3738
imagemagick,
39+
unzip,
3840
}:
3941

4042
let
@@ -136,6 +138,21 @@ let
136138
"ezlib"
137139
];
138140

141+
# Required now since the Makefile doesn’t make this an optional dependency
142+
# despite every indication that it should be. Hopefully this is temporary.
143+
# See: https://github.com/processone/ejabberd/issues/4554
144+
invitePageDeps = {
145+
# Ideally this could be removed too as jQuery isn’t Bootstrap 5.x requirement
146+
# See: https://github.com/processone/ejabberd/issues/4555
147+
jquery = fetchurl {
148+
url = "https://code.jquery.com/jquery-4.0.0.min.js";
149+
sha256 = "39a546ea9ad97f8bfaf5d3e0e8f8556adb415e470e59007ada9759dce472adaa";
150+
};
151+
bootstrap = fetchurl {
152+
url = "https://github.com/twbs/bootstrap/releases/download/v5.3.8/bootstrap-5.3.8-dist.zip";
153+
sha256 = "3258c873cbcb1e2d81f4374afea2ea6437d9eee9077041073fd81dd579c5ba6b";
154+
};
155+
};
139156
in
140157
stdenv.mkDerivation (finalAttrs: {
141158
pname = "ejabberd";
@@ -150,6 +167,7 @@ stdenv.mkDerivation (finalAttrs: {
150167
rebar3_hex
151168
];
152169
})
170+
unzip # invitePageDeps
153171
];
154172

155173
buildInputs = [
@@ -189,13 +207,22 @@ stdenv.mkDerivation (finalAttrs: {
189207
]
190208
++ lib.optional withSqlite "--with-sqlite3=${sqlite.dev}";
191209

192-
enableParallelBuilding = true;
210+
# The derivation wants to execute 2 dl_invites_page_deps.sh in parallel
211+
# causing unzip conflicts
212+
enableParallelBuilding = false;
193213

194214
postPatch = ''
195215
patchShebangs .
196216
mkdir -p _build/default/lib
197217
touch _build/default/lib/.got
198218
touch _build/default/lib/.built
219+
# HACK: patching deps fetcher shell script to cp in our dependencies to
220+
# circumvent cURL being called to fetch dependencies from the Makefile
221+
# (which fails in the sandbox).
222+
sed -i \
223+
-e 's|curl .* $jquery .*|cp "${invitePageDeps.jquery}" "$jquery"|' \
224+
-e 's|curl .* $bootstrap .*|cp "${invitePageDeps.bootstrap}" "$bootstrap"|' \
225+
tools/dl_invites_page_deps.sh
199226
'';
200227

201228
env.REBAR_IGNORE_DEPS = 1;

0 commit comments

Comments
 (0)