From da84bc4a89958691068fa7e77023b194138317d0 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Fri, 19 Apr 2013 10:46:31 -0400 Subject: [PATCH] rabbitmq-server: Put files in $HOME by default Before, files were put in /var, requiring the server to be run as a privileged user even when just testing locally. This can be overridden by setting the SYS_PREFIX env variable, or on a more coarse-grained basis in /etc/rabbitmq/rabbitmq-env.conf Signed-off-by: Shea Levy --- pkgs/servers/amqp/rabbitmq-server/default.nix | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/amqp/rabbitmq-server/default.nix b/pkgs/servers/amqp/rabbitmq-server/default.nix index 043c69d5cc0e..59788be15d11 100644 --- a/pkgs/servers/amqp/rabbitmq-server/default.nix +++ b/pkgs/servers/amqp/rabbitmq-server/default.nix @@ -2,10 +2,12 @@ , docbook_xml_dtd_45, docbook_xsl, zip, unzip }: stdenv.mkDerivation rec { - name = "rabbitmq-server-3.0.3"; + name = "rabbitmq-server-${version}"; + + version = "3.0.3"; src = fetchurl { - url = "http://www.rabbitmq.com/releases/rabbitmq-server/v3.0.3/${name}.tar.gz"; + url = "http://www.rabbitmq.com/releases/rabbitmq-server/v${version}/${name}.tar.gz"; sha256 = "07mp57xvszdrlgw8rgn9r9dpa6vdqdjk7f1dyh6a9sdg8s9fby38"; }; @@ -20,6 +22,14 @@ stdenv.mkDerivation rec { installFlags = "TARGET_DIR=$(out)/libexec/rabbitmq SBIN_DIR=$(out)/sbin MAN_DIR=$(out)/share/man"; + preInstall = + '' + sed -i \ + -e 's|SYS_PREFIX=|SYS_PREFIX=''${SYS_PREFIX-''${HOME}/.rabbitmq/${version}}|' \ + -e 's|CONF_ENV_FILE=''${SYS_PREFIX}\(.*\)|CONF_ENV_FILE=\1|' \ + scripts/rabbitmq-defaults + ''; + postInstall = '' echo 'PATH=${erlang}/bin:${PATH:+:}$PATH' >> $out/sbin/rabbitmq-env