3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/servers/amqp/rabbitmq-server/default.nix

75 lines
2.5 KiB
Nix
Raw Normal View History

2021-01-15 07:07:56 +00:00
{ lib, stdenv, fetchurl, erlang, elixir, python, libxml2, libxslt, xmlto
, docbook_xml_dtd_45, docbook_xsl, zip, unzip, rsync, getconf, socat
, procps, coreutils, gnused, systemd, glibcLocales
, AppKit, Carbon, Cocoa
, nixosTests
}:
2018-04-11 00:54:11 +01:00
stdenv.mkDerivation rec {
pname = "rabbitmq-server";
2020-11-11 22:59:10 +00:00
version = "3.8.9";
# when updating, consider bumping elixir version in all-packages.nix
src = fetchurl {
url = "https://github.com/rabbitmq/rabbitmq-server/releases/download/v${version}/${pname}-${version}.tar.xz";
2020-11-11 22:59:10 +00:00
sha256 = "0b252l9r45h8r5gibdqcn6hhbm8g6rfzhm1k9d39pwhs5x77cjqv";
};
nativeBuildInputs = [ unzip ];
buildInputs =
[ erlang elixir python libxml2 libxslt xmlto docbook_xml_dtd_45 docbook_xsl zip rsync glibcLocales ]
2021-01-15 07:07:56 +00:00
++ lib.optionals stdenv.isDarwin [ AppKit Carbon Cocoa ];
outputs = [ "out" "man" "doc" ];
2019-11-05 01:10:31 +00:00
installFlags = [ "PREFIX=$(out)" "RMQ_ERLAPP_DIR=$(out)" ];
installTargets = [ "install" "install-man" ];
preBuild = ''
export LANG=C.UTF-8 # fix elixir locale warning
'';
2021-01-15 07:07:56 +00:00
runtimePath = lib.makeBinPath ([
erlang
getconf # for getting memory limits
socat procps
gnused coreutils # used by helper scripts
2021-01-15 07:07:56 +00:00
] ++ lib.optionals stdenv.isLinux [ systemd ]); # for systemd unit activation check
postInstall = ''
# rabbitmq-env calls to sed/coreutils, so provide everything early
sed -i $out/sbin/rabbitmq-env -e '2s|^|PATH=${runtimePath}\''${PATH:+:}\$PATH/\n|'
# rabbitmq-server script uses `dirname` to get hold of a
# rabbitmq-env, so let's provide this file directly. After that
# point everything is OK - the PATH above will kick in
substituteInPlace $out/sbin/rabbitmq-server \
--replace '`dirname $0`/rabbitmq-env' \
"$out/sbin/rabbitmq-env"
# We know exactly where rabbitmq is gonna be, so we patch that into the env-script.
# By doing it early we make sure that auto-detection for this will
# never be executed (somewhere below in the script).
sed -i $out/sbin/rabbitmq-env -e "2s|^|RABBITMQ_SCRIPTS_DIR=$out/sbin\n|"
# theres a few stray files that belong into share
mkdir -p $doc/share/doc/rabbitmq-server
mv $out/LICENSE* $doc/share/doc/rabbitmq-server
# and an unecessarily copied INSTALL file
rm $out/INSTALL
'';
meta = {
2020-03-10 11:13:39 +00:00
homepage = "https://www.rabbitmq.com/";
description = "An implementation of the AMQP messaging protocol";
2021-01-15 07:07:56 +00:00
license = lib.licenses.mpl20;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ Profpatsch ];
};
passthru.tests = {
vm-test = nixosTests.rabbitmq;
};
}