nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 138 lines 3.2 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 erlang, 6 elixir, 7 python3, 8 libxml2, 9 libxslt, 10 xmlto, 11 docbook_xml_dtd_45, 12 docbook_xsl, 13 zip, 14 unzip, 15 rsync, 16 getconf, 17 socat, 18 procps, 19 coreutils, 20 gnused, 21 systemd, 22 glibcLocales, 23 nixosTests, 24 which, 25}: 26 27let 28 runtimePath = lib.makeBinPath ( 29 [ 30 erlang 31 getconf # for getting memory limits 32 socat 33 gnused 34 coreutils # used by helper scripts 35 ] 36 ++ lib.optionals stdenv.hostPlatform.isLinux [ 37 procps # the built-in macOS version has extra entitlements to read rss 38 systemd # for systemd unit activation check 39 ] 40 ); 41in 42 43stdenv.mkDerivation rec { 44 pname = "rabbitmq-server"; 45 version = "4.0.9"; 46 47 # when updating, consider bumping elixir version in all-packages.nix 48 src = fetchurl { 49 url = "https://github.com/rabbitmq/rabbitmq-server/releases/download/v${version}/${pname}-${version}.tar.xz"; 50 hash = "sha256-imBxBn8RQS0jBGfT5KLLLt+fKvyybzLzPZu9DpFOos8="; 51 }; 52 53 nativeBuildInputs = [ 54 unzip 55 xmlto 56 docbook_xml_dtd_45 57 docbook_xsl 58 zip 59 rsync 60 python3 61 which 62 ]; 63 64 buildInputs = [ 65 erlang 66 elixir 67 libxml2 68 libxslt 69 glibcLocales 70 ]; 71 72 outputs = [ 73 "out" 74 "man" 75 "doc" 76 ]; 77 78 installFlags = [ 79 "PREFIX=${placeholder "out"}" 80 "RMQ_ERLAPP_DIR=${placeholder "out"}" 81 ]; 82 83 installTargets = [ 84 "install" 85 "install-man" 86 ]; 87 88 preBuild = '' 89 export LANG=C.UTF-8 # fix elixir locale warning 90 export PROJECT_VERSION="$version" 91 ''; 92 93 postInstall = '' 94 # rabbitmq-env calls to sed/coreutils, so provide everything early 95 sed -i $out/sbin/rabbitmq-env -e '2s|^|PATH=${runtimePath}\''${PATH:+:}\$PATH/\n|' 96 97 # We know exactly where rabbitmq is gonna be, so we patch that into the env-script. 98 # By doing it early we make sure that auto-detection for this will 99 # never be executed (somewhere below in the script). 100 sed -i $out/sbin/rabbitmq-env -e "2s|^|RABBITMQ_SCRIPTS_DIR=$out/sbin\n|" 101 102 # theres a few stray files that belong into share 103 mkdir -p $doc/share/doc/rabbitmq-server 104 mv $out/LICENSE* $doc/share/doc/rabbitmq-server 105 106 # and an unecessarily copied INSTALL file 107 rm $out/INSTALL 108 ''; 109 110 # Can not use versionCheckHook since that doesn't allow for setting environment variables 111 # which is necessary since Erlang needs a $HOME for the Cookie. 112 doInstallCheck = true; 113 installCheckPhase = '' 114 runHook preInstallCheck 115 out="$(env - LANG=C.utf8 HOME=$TMPDIR ${placeholder "out"}/bin/rabbitmqctl version)" 116 if [[ "$out" != "$version" ]]; then 117 echo "Rabbitmq should report version $version, but thinks it's version $out" >&2 118 exit 1 119 fi 120 runHook postInstallCheck 121 ''; 122 123 # Needed for the check in installCheckPhase 124 __darwinAllowLocalNetworking = true; 125 126 passthru.tests = { 127 vm-test = nixosTests.rabbitmq; 128 }; 129 130 meta = { 131 homepage = "https://www.rabbitmq.com/"; 132 description = "Implementation of the AMQP messaging protocol"; 133 changelog = "https://github.com/rabbitmq/rabbitmq-server/releases/tag/v${version}"; 134 license = lib.licenses.mpl20; 135 platforms = lib.platforms.unix; 136 maintainers = with lib.maintainers; [ samueltardieu ]; 137 }; 138}