From 50c345663869e0d6eee31e5e796e9e33f1323c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Wed, 25 Dec 2024 22:25:17 +0100 Subject: [PATCH] rabbitmq-server: Fix reported version (#367395) Fixes the version in `rabbitmqctl --version` and the web interface (cherry picked from commit 271637da39dddb3ee6f8a14db009004168a99a9b) --- pkgs/servers/amqp/rabbitmq-server/default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/servers/amqp/rabbitmq-server/default.nix b/pkgs/servers/amqp/rabbitmq-server/default.nix index 383ab5af129f1..1901cfc6ff3d0 100644 --- a/pkgs/servers/amqp/rabbitmq-server/default.nix +++ b/pkgs/servers/amqp/rabbitmq-server/default.nix @@ -94,6 +94,7 @@ stdenv.mkDerivation rec { preBuild = '' export LANG=C.UTF-8 # fix elixir locale warning + export PROJECT_VERSION="$version" ''; postInstall = '' @@ -113,6 +114,19 @@ stdenv.mkDerivation rec { rm $out/INSTALL ''; + # Can not use versionCheckHook since that doesn't allow for setting environment variables + # which is necessary since Erlang needs a $HOME for the Cookie. + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + out="$(env - LANG=C.utf8 HOME=/build ${placeholder "out"}/bin/rabbitmqctl version)" + if [[ "$out" != "$version" ]]; then + echo "Rabbitmq should report version $version, but thinks it's version $out" >&2 + exit 1 + fi + runHook postInstallCheck + ''; + passthru.tests = { vm-test = nixosTests.rabbitmq; };