nixpkgs/pkgs/servers/nosql/cassandra/generic.nix
Casey Ransom 6ce28ca5c0 cassandra: refactor versioning
This change:
- refactors the packages so it is easier to create and update new versions of
  cassandra.
- fixes a bug where Cassandra will not connect to another member unless
  LD_PRELOADing libstdc++.so. Without that change, it generates a stack trace
  and dies with exceptions regarding org.xerial.snappy.
- restricts platform to linux as procps is also linux only.
2016-08-02 20:58:35 -04:00

50 lines
1.4 KiB
Nix

{ stdenv, fetchurl, python, makeWrapper, gawk, bash, getopt, procps
, which, jre, version, sha256, ...
}:
let
libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc ];
binPath = stdenv.lib.makeBinPath [ bash getopt gawk procps which jre ];
in
stdenv.mkDerivation rec {
name = "cassandra-${version}";
src = fetchurl {
inherit sha256;
url = "mirror://apache/cassandra/${version}/apache-${name}-bin.tar.gz";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir $out
mv * $out
for cmd in bin/cassandra bin/nodetool bin/sstablekeys \
bin/sstableloader bin/sstableupgrade \
tools/bin/cassandra-stress tools/bin/cassandra-stressd \
tools/bin/sstablemetadata tools/bin/sstableofflinerelevel \
tools/bin/token-generator tools/bin/sstablelevelreset; do
# check if file exists because some bin tools don't exist across all
# cassandra versions
if [ -f $out/$cmd ]; then
wrapProgram $out/$cmd \
--suffix-each LD_LIBRARY_PATH : ${libPath} \
--prefix PATH : ${binPath} \
--set JAVA_HOME ${jre}
fi
done
wrapProgram $out/bin/cqlsh --prefix PATH : ${python}/bin
'';
meta = with stdenv.lib; {
homepage = http://cassandra.apache.org/;
description = "A massively scalable open source NoSQL database";
platforms = platforms.linux;
license = licenses.asl20;
maintainers = with maintainers; [ nckx rushmorem cransom ];
};
}