Skip to content

ejabberd: 26.02 → 26.03#504293

Open
toastal wants to merge 3 commits intoNixOS:masterfrom
toastal:ejabberd-26.03
Open

ejabberd: 26.02 → 26.03#504293
toastal wants to merge 3 commits intoNixOS:masterfrom
toastal:ejabberd-26.03

Conversation

@toastal
Copy link
Copy Markdown
Contributor

@toastal toastal commented Mar 28, 2026

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

1

Footnotes

  1. Please consider giving up MS GitHub or offering a non-proprietary, non-US-corporate-controlled mirror for this free software project. I wish to delete this Microsoft account in the future, but I need more projects like this to support alternative methods to send patches & contribute.

@toastal toastal requested a review from chuangzhu March 28, 2026 05:53
@toastal
Copy link
Copy Markdown
Contributor Author

toastal commented Mar 28, 2026

@chuangzhujiffy is no longer in the rebar.lock. I assume it isn’t a dep?

Running phase: autoreconfPhase
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
...skipping...
chmod 755 ejabberd.init
tools/dl_invites_page_deps.sh: line 20: curl: command not found
make: *** [Makefile:236: priv/mod_invites/static/bootstrap/] Error 127
make: *** Waiting for unfinished jobs....
tools/dl_invites_page_deps.sh: line 20: curl: command not found
make: *** [Makefile:238: priv/mod_invites/static/jquery/] Error 127
===> Errors loading plugin configure_deps. Run rebar3 with DEBUG=1 set to see errors.
===> Errors loading plugin {pc,"~> 1.15.0"}. Run rebar3 with DEBUG=1 set to see errors.
===> Errors loading plugin {pc,"~> 1.15.0"}. Run rebar3 with DEBUG=1 set to see errors.
Ignoring deps...
===> App cache_tab is no longer needed and can be deleted.
===> App eimp is no longer needed and can be deleted.
===> App erlydtl is no longer needed and can be deleted.
===> App ezlib is no longer needed and can be deleted.
===> App fast_tls is no longer needed and can be deleted.
===> App fast_xml is no longer needed and can be deleted.
===> App fast_yaml is no longer needed and can be deleted.
===> App idna is no longer needed and can be deleted.
===> App jose is no longer needed and can be deleted.
===> App mqtree is no longer needed and can be deleted.
===> App p1_acme is no longer needed and can be deleted.
===> App p1_oauth2 is no longer needed and can be deleted.
===> App p1_utils is no longer needed and can be deleted.
===> App pkix is no longer needed and can be deleted.
===> App stringprep is no longer needed and can be deleted.
===> App stun is no longer needed and can be deleted.
===> App xmpp is no longer needed and can be deleted.
===> App yconf is no longer needed and can be deleted.
===> Analyzing applications...
===> Compiling ejabberd

I think it might be failing on getting Twitter Bootstrap & jQuery for mod_invites but doing that in the Makefile.

@nixpkgs-ci nixpkgs-ci bot added 8.has: package (update) This PR updates a package to a newer version 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Mar 28, 2026
@chuangzhu
Copy link
Copy Markdown
Contributor

I think it might be failing on getting Twitter Bootstrap & jQuery for mod_invites but doing that in the Makefile.

We actually have two options:

ifeq (, $(shell which npm))
  INSTALL_INVITES_DEPS=tools/dl_invites_page_deps.sh priv/mod_invites/static
else
  INSTALL_INVITES_DEPS=npm install
endif

If the deps get complicated, we can use something like buildNpmPackages. But for now that seemed like overengineering since there are only two deps. Patching tools/dl_invites_page_deps.sh seems more reasonable.

@chuangzhu
Copy link
Copy Markdown
Contributor

diff --git a/pkgs/by-name/ej/ejabberd/package.nix b/pkgs/by-name/ej/ejabberd/package.nix
index bdec28abbf8a..3ec1606bf4af 100644
--- a/pkgs/by-name/ej/ejabberd/package.nix
+++ b/pkgs/by-name/ej/ejabberd/package.nix
@@ -20,6 +20,8 @@
   fetchFromGitHub,
   fetchgit,
   beamPackages,
+  fetchurl,
+  unzip,
   nixosTests,
   withMysql ? false,
   withPgsql ? false,
@@ -136,6 +138,17 @@ let
     "ezlib"
   ];
 
+  invitePageDeps = {
+    jquery = fetchurl {
+      url = "https://code.jquery.com/jquery-4.0.0.min.js";
+      sha256 = "39a546ea9ad97f8bfaf5d3e0e8f8556adb415e470e59007ada9759dce472adaa";
+    };
+    bootstrap = fetchurl {
+      url = "https://github.com/twbs/bootstrap/releases/download/v5.3.8/bootstrap-5.3.8-dist.zip";
+      sha256 = "3258c873cbcb1e2d81f4374afea2ea6437d9eee9077041073fd81dd579c5ba6b";
+    };
+  };
+
 in
 stdenv.mkDerivation (finalAttrs: {
   pname = "ejabberd";
@@ -150,6 +163,7 @@ stdenv.mkDerivation (finalAttrs: {
         rebar3_hex
       ];
     })
+    unzip # invitePageDeps
   ];
 
   buildInputs = [
@@ -189,13 +203,19 @@ stdenv.mkDerivation (finalAttrs: {
   ]
   ++ lib.optional withSqlite "--with-sqlite3=${sqlite.dev}";
 
-  enableParallelBuilding = true;
+  # It wants to execute two dl_invites_page_deps.sh in parallel
+  # Causing unzip conflicts
+  enableParallelBuilding = false;
 
   postPatch = ''
     patchShebangs .
     mkdir -p _build/default/lib
     touch _build/default/lib/.got
     touch _build/default/lib/.built
+    sed -i \
+      -e 's|curl .* $jquery .*|cp ${invitePageDeps.jquery} $jquery|' \
+      -e 's|curl .* $bootstrap .*|cp ${invitePageDeps.bootstrap} $bootstrap|' \
+      tools/dl_invites_page_deps.sh
   '';
 
   env.REBAR_IGNORE_DEPS = 1;

@toastal
Copy link
Copy Markdown
Contributor Author

toastal commented Mar 30, 2026

That’s one solution… doesn’t scale the best. Since they use SRIs, if we don’t have our versions in sync with upstream, we won’t know about breakage until runtime where we don’t match their hashes—which could mean a NixOS upgrade could make the invites not work entirely. Had they not included SRIs on the page, it would probably be fine/safe to be slightly out of sync on versions.

I opened these upstream to see if they have any takes:

We could run the script in IFD perhaps to fetch (slow, but small deps) or use the npm Hooks (pulls in a massive, questionable toolchain just to fetch deps).

Additionally, since mod_invites can be disabled, I think they made the wrong choice requiring these dependencies.

@chuangzhu
Copy link
Copy Markdown
Contributor

chuangzhu commented Mar 30, 2026

we won’t know about breakage until runtime where we don’t match their hashes

I tested the patch I posted above with this:

diff --git a/pkgs/by-name/ej/ejabberd/package.nix b/pkgs/by-name/ej/ejabberd/package.nix
index 3ec1606bf4af..160967eed12e 100644
--- a/pkgs/by-name/ej/ejabberd/package.nix
+++ b/pkgs/by-name/ej/ejabberd/package.nix
@@ -140,8 +140,8 @@ let
 
   invitePageDeps = {
     jquery = fetchurl {
-      url = "https://code.jquery.com/jquery-4.0.0.min.js";
-      sha256 = "39a546ea9ad97f8bfaf5d3e0e8f8556adb415e470e59007ada9759dce472adaa";
+      url = "https://code.jquery.com/jquery-3.0.0.min.js";
+      sha256 = "266bcea0bb58b26aa5b16c5aee60d22ccc1ae9d67daeb21db6bad56119c3447d";
     };
     bootstrap = fetchurl {
       url = "https://github.com/twbs/bootstrap/releases/download/v5.3.8/bootstrap-5.3.8-dist.zip";

And it totally noticed the checksum mismatch:

ejabberd> tools/dl_invites_page_deps.sh priv/mod_invites/static
ejabberd> /tmp/jquery.DGdCBgFFs: FAILED
ejabberd> sha256sum: WARNING: 1 computed checksum did NOT match
ejabberd> checksum failed: /tmp/jquery.DGdCBgFFs (does not match 39a546ea9ad97f8bfaf5d3e0e8f8556adb415e470e59007ada9759dce472adaa)
ejabberd> make: *** [Makefile:236: priv/mod_invites/static/bootstrap/] Error 1
error: Cannot build '/nix/store/6k7852y0q84114cysr2y9yn303ikyvam-ejabberd-26.03.drv'.
       Reason: builder failed with exit code 2.
       Output paths:
         /nix/store/m43g3j8rw651rv85hvi250x134zy6y3n-ejabberd-26.03

I only changed curl to cp, I didn't delete the checksum logic.

@chuangzhu
Copy link
Copy Markdown
Contributor

I think they made the wrong choice requiring these dependencies.

I would argue it's not that bad (at least for now...). I've seen much worse

@toastal
Copy link
Copy Markdown
Contributor Author

toastal commented Mar 30, 2026

I see what you did, but was I hoping we can have a better solution.

However, having thought on it a bit, this could be good enough for now as it likely won’t be addressed in the near term. Hopefully it can trip on the version with diff not being very smart to catch version mismatches.

I’d rather they ripped the SRIs out so I could recompile Bootstrap for a specific target (meaning Browserslist) or in line with 5.x upstream generally vs. Ejabberd’s specific version. Subresource integrity is best for using with third-party scripts (never ideal) & since these deps are already vendored & checked with their hashes, I don’t know what they are getting out of checking again at runtime.

I would argue it's not that bad (at least for now...). I've seen much worse

True, but it also doesn’t make a lot of sense since a) you can disable the module & b) the docs say you can point to your own endpoint… both of which don’t need it.

@chuangzhu chuangzhu requested a review from a team March 30, 2026 12:07
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.
@adamcstephens
Copy link
Copy Markdown
Contributor

While I have little skin in this game, I would recommend accepting that there's now nodejs in this package and using standard npm fetchers/builders.Using fetchers like this is a bit too much of a hack around the problem, in my opinion.

# despite every indication that it should be. Hopefully this is temporary.
# See: https://github.com/processone/ejabberd/issues/4554
invitePageDeps = {
# Ideally this could be removed too as jQuery isn’t Bootstrap 5.x requirement

This comment was marked as off-topic.

@toastal
Copy link
Copy Markdown
Contributor Author

toastal commented Mar 30, 2026

I had looked into the npm option in the WIP (now reverted), but I didn’t like the way it was going just to fetch 2 dependencies. Since I thought this was not very good design, I reported it on their bug tracker & would rather see upstream’s response. At least we could gate Node.js behind withInvitePageDeps ? true/false in future versions if they agree the design should be better.

Sorry, this whole issue really frustrated me being a, well I guess now ex-, front-end developer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: package (update) This PR updates a package to a newer version 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants