Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rabbitmq-server: Fix reported version #367395

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkgs/by-name/ra/rabbitmq-server/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ stdenv.mkDerivation rec {

preBuild = ''
export LANG=C.UTF-8 # fix elixir locale warning
export PROJECT_VERSION="$version"
'';

postInstall = ''
Expand All @@ -106,6 +107,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.
Comment on lines +110 to +111
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testers.testVersion can be used with custom env variables. Something along the lines of:

passthru.tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
command = ''
QT_QPA_PLATFORM=minimal ${finalAttrs.finalPackage.meta.mainProgram} --version
'';
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd advocate for the hook

Fine by me, but I'd like for someone else to chime in as well.

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;
};
Expand Down
Loading