2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchurl, python, makeWrapper, gawk, bash, getopt, procps
|
2020-12-09 12:01:56 +00:00
|
|
|
, which, jre, coreutils, nixosTests
|
|
|
|
# generation is the attribute version suffix such as 3_11 in pkgs.cassandra_3_11
|
|
|
|
, generation
|
|
|
|
, version, sha256
|
|
|
|
, ...
|
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 {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "cassandra";
|
2017-11-07 13:11:56 +00:00
|
|
|
inherit version;
|
2016-07-22 20:34:43 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
inherit sha256;
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "mirror://apache/cassandra/${version}/apache-${pname}-${version}-bin.tar.gz";
|
2016-07-22 20:34:43 +01:00
|
|
|
};
|
|
|
|
|
2019-04-09 05:31:55 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper coreutils ];
|
2016-07-22 20:34:43 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
mv * $out
|
2017-08-16 14:22:27 +01:00
|
|
|
|
|
|
|
# Clean up documentation.
|
2019-08-15 13:41:18 +01:00
|
|
|
mkdir -p $out/share/doc/${pname}-${version}
|
2017-08-16 14:22:27 +01:00
|
|
|
mv $out/CHANGES.txt \
|
|
|
|
$out/LICENSE.txt \
|
|
|
|
$out/NEWS.txt \
|
|
|
|
$out/NOTICE.txt \
|
|
|
|
$out/javadoc \
|
2019-08-15 13:41:18 +01:00
|
|
|
$out/share/doc/${pname}-${version}
|
2017-08-16 14:22:27 +01:00
|
|
|
|
|
|
|
if [[ -d $out/doc ]]; then
|
2019-08-15 13:41:18 +01:00
|
|
|
mv "$out/doc/"* $out/share/doc/${pname}-${version}
|
2017-08-16 14:22:27 +01:00
|
|
|
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 \
|
2019-04-09 05:31:55 +01:00
|
|
|
bin/sstableverify; do
|
|
|
|
# Check if file exists because some don't exist across all versions
|
|
|
|
if [ -f $out/$cmd ]; then
|
|
|
|
wrapProgram $out/bin/$(basename "$cmd") \
|
|
|
|
--suffix-each LD_LIBRARY_PATH : ${libPath} \
|
|
|
|
--prefix PATH : ${binPath} \
|
|
|
|
--set JAVA_HOME ${jre}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
for cmd in tools/bin/cassandra-stress \
|
2019-04-07 14:53:57 +01:00
|
|
|
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
|
2019-04-09 05:31:55 +01:00
|
|
|
# Check if file exists because some don't exist across all versions
|
2016-07-22 20:34:43 +01:00
|
|
|
if [ -f $out/$cmd ]; then
|
2019-04-09 05:31:55 +01:00
|
|
|
makeWrapper $out/$cmd $out/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
|
|
|
|
'';
|
|
|
|
|
2020-12-09 12:01:56 +00:00
|
|
|
passthru = {
|
|
|
|
tests =
|
|
|
|
let
|
|
|
|
test = nixosTests."cassandra_${generation}";
|
|
|
|
in {
|
|
|
|
nixos =
|
|
|
|
assert test.testPackage.version == version;
|
|
|
|
test;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://cassandra.apache.org/";
|
2016-07-22 20:34:43 +01:00
|
|
|
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;
|
2020-12-14 14:37:46 +00:00
|
|
|
maintainers = [ maintainers.roberth ];
|
2016-07-22 20:34:43 +01:00
|
|
|
};
|
|
|
|
}
|