2016-07-22 20:34:43 +01:00
|
|
|
{ stdenv, fetchurl, python, makeWrapper, gawk, bash, getopt, procps
|
2019-04-07 14:53:57 +01:00
|
|
|
, which, jre, version, sha256, coreutils, ...
|
2016-07-22 20:34:43 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
libPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc ];
|
2016-10-06 20:45:11 +01:00
|
|
|
binPath = with stdenv.lib; makeBinPath ([
|
|
|
|
bash
|
|
|
|
getopt
|
|
|
|
gawk
|
|
|
|
which
|
|
|
|
jre
|
2018-03-26 05:01:31 +01:00
|
|
|
procps
|
|
|
|
]);
|
2016-07-22 20:34:43 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "cassandra-${version}";
|
2017-11-07 13:11:56 +00:00
|
|
|
inherit version;
|
2016-07-22 20:34:43 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
inherit sha256;
|
|
|
|
url = "mirror://apache/cassandra/${version}/apache-${name}-bin.tar.gz";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
mv * $out
|
2017-08-16 14:22:27 +01:00
|
|
|
|
|
|
|
# Clean up documentation.
|
|
|
|
mkdir -p $out/share/doc/${name}
|
|
|
|
mv $out/CHANGES.txt \
|
|
|
|
$out/LICENSE.txt \
|
|
|
|
$out/NEWS.txt \
|
|
|
|
$out/NOTICE.txt \
|
|
|
|
$out/javadoc \
|
|
|
|
$out/share/doc/${name}
|
|
|
|
|
|
|
|
if [[ -d $out/doc ]]; then
|
|
|
|
mv "$out/doc/"* $out/share/doc/${name}
|
|
|
|
rmdir $out/doc
|
|
|
|
fi
|
|
|
|
|
2019-04-07 14:53:57 +01:00
|
|
|
|
|
|
|
for cmd in bin/cassandra \
|
|
|
|
bin/nodetool \
|
|
|
|
bin/sstablekeys \
|
|
|
|
bin/sstableloader \
|
|
|
|
bin/sstablescrub \
|
|
|
|
bin/sstableupgrade \
|
|
|
|
bin/sstableutil \
|
|
|
|
bin/sstableverify \
|
|
|
|
tools/bin/cassandra-stress \
|
|
|
|
tools/bin/cassandra-stressd \
|
|
|
|
tools/bin/sstabledump \
|
|
|
|
tools/bin/sstableexpiredblockers \
|
|
|
|
tools/bin/sstablelevelreset \
|
|
|
|
tools/bin/sstablemetadata \
|
|
|
|
tools/bin/sstableofflinerelevel \
|
|
|
|
tools/bin/sstablerepairedset \
|
|
|
|
tools/bin/sstablesplit \
|
|
|
|
tools/bin/token-generator; do
|
2016-07-22 20:34:43 +01:00
|
|
|
|
|
|
|
# check if file exists because some bin tools don't exist across all
|
|
|
|
# cassandra versions
|
|
|
|
if [ -f $out/$cmd ]; then
|
2019-04-07 14:53:57 +01:00
|
|
|
makeWrapper $out/$cmd $out/bin/$(${coreutils}/bin/basename "$cmd") \
|
2016-07-22 20:34:43 +01:00
|
|
|
--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";
|
2016-10-06 20:45:11 +01:00
|
|
|
platforms = platforms.unix;
|
2016-07-22 20:34:43 +01:00
|
|
|
license = licenses.asl20;
|
2018-01-16 21:59:13 +00:00
|
|
|
maintainers = with maintainers; [ cransom ];
|
2016-07-22 20:34:43 +01:00
|
|
|
};
|
|
|
|
}
|