2021-05-03 20:48:10 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
2021-08-05 21:33:18 +00:00
|
|
|
, python2
|
2021-05-03 20:48:10 +00:00
|
|
|
, makeWrapper
|
|
|
|
, gawk
|
|
|
|
, bash
|
|
|
|
, getopt
|
|
|
|
, procps
|
|
|
|
, which
|
|
|
|
, jre
|
|
|
|
, coreutils
|
|
|
|
, nixosTests
|
|
|
|
# generation is the attribute version suffix such as 3_11 in pkgs.cassandra_3_11
|
2020-12-25 13:55:36 +00:00
|
|
|
, generation
|
2021-05-03 20:48:10 +00:00
|
|
|
, version
|
|
|
|
, sha256
|
|
|
|
, extraMeta ? { }
|
2020-12-25 13:55:36 +00:00
|
|
|
, ...
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-01-15 22:18:51 +00:00
|
|
|
libPath = lib.makeLibraryPath [ stdenv.cc.cc ];
|
2021-05-03 20:48:10 +00:00
|
|
|
binPath = lib.makeBinPath [
|
2020-04-24 23:36:52 +00:00
|
|
|
bash
|
|
|
|
getopt
|
|
|
|
gawk
|
|
|
|
which
|
|
|
|
jre
|
|
|
|
procps
|
2021-05-03 20:48:10 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "cassandra";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
inherit sha256;
|
|
|
|
url = "mirror://apache/cassandra/${version}/apache-${pname}-${version}-bin.tar.gz";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper coreutils ];
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-02-19 19:06:45 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir $out
|
|
|
|
mv * $out
|
|
|
|
|
|
|
|
# Clean up documentation.
|
|
|
|
mkdir -p $out/share/doc/${pname}-${version}
|
|
|
|
mv $out/CHANGES.txt \
|
|
|
|
$out/LICENSE.txt \
|
|
|
|
$out/NEWS.txt \
|
|
|
|
$out/NOTICE.txt \
|
|
|
|
$out/javadoc \
|
|
|
|
$out/share/doc/${pname}-${version}
|
|
|
|
|
|
|
|
if [[ -d $out/doc ]]; then
|
|
|
|
mv "$out/doc/"* $out/share/doc/${pname}-${version}
|
|
|
|
rmdir $out/doc
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
for cmd in bin/cassandra \
|
|
|
|
bin/nodetool \
|
|
|
|
bin/sstablekeys \
|
|
|
|
bin/sstableloader \
|
|
|
|
bin/sstablescrub \
|
|
|
|
bin/sstableupgrade \
|
|
|
|
bin/sstableutil \
|
|
|
|
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 \
|
|
|
|
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
|
|
|
|
# Check if file exists because some don't exist across all versions
|
|
|
|
if [ -f $out/$cmd ]; then
|
|
|
|
makeWrapper $out/$cmd $out/bin/$(basename "$cmd") \
|
|
|
|
--suffix-each LD_LIBRARY_PATH : ${libPath} \
|
|
|
|
--prefix PATH : ${binPath} \
|
|
|
|
--set JAVA_HOME ${jre}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
wrapProgram $out/bin/cqlsh --prefix PATH : ${python2}/bin
|
2021-02-19 19:06:45 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2021-05-03 20:48:10 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
passthru = {
|
|
|
|
tests =
|
|
|
|
let
|
|
|
|
test = nixosTests."cassandra_${generation}";
|
2021-05-03 20:48:10 +00:00
|
|
|
in
|
|
|
|
{
|
2020-12-25 13:55:36 +00:00
|
|
|
nixos =
|
|
|
|
assert test.testPackage.version == version;
|
|
|
|
test;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://cassandra.apache.org/";
|
|
|
|
description = "A massively scalable open source NoSQL database";
|
|
|
|
platforms = platforms.unix;
|
|
|
|
license = licenses.asl20;
|
2020-12-25 13:55:36 +00:00
|
|
|
maintainers = [ maintainers.roberth ];
|
2021-02-19 19:06:45 +00:00
|
|
|
} // extraMeta;
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|